Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support JSON line output. #8242

Closed
wants to merge 4 commits into from

Conversation

scotthovestadt
Copy link
Contributor

Summary

JSON output, especially as currently implemented, has a few limitations:

  • The size of the output scales directly with the number of tests, or in case of coverage, files in the project. This eventually breaks down and causes OOMs unless a JSON parser capable of streaming is implemented both on Jest's side and the implementation side, which would mean introducing additional dependencies and requiring similar dependencies. Will become even more of a problem as the output size grows.
  • We only provide a single JSON response, meaning that there is no feedback until the end and anything we want to output must be held in memory until then. Streaming JSON lines means we can potentially free memory earlier and provide signal earlier to any integrations.
  • We push the large JSON object directly to stdout without any chunking. It's possible to overflow the output buffer and cause OOMs in that way.

It's worth noting that the OOMs caused by these issues are not theoretical. :)

Related PR:
#8091

This PR is the first step to resolving these problems. There is clearly still room for improvement-- all output is still batched at the end, for example. All feedback welcomed.

Example output:

{"runResults":{"numFailedTestSuites":0,"numFailedTests":0,"numPassedTestSuites":12,"numPassedTests":924,"numPendingTestSuites":0,"numPendingTests":0,"numRuntimeErrorTestSuites":0,"numTodoTests":0,"numTotalTestSuites":12,"numTotalTests":924,"openHandles":[],"snapshot":{"added":0,"didUpdate":false,"failure":false,"filesAdded":0,"filesRemoved":0,"filesUnmatched":0,"filesUpdated":0,"matched":860,"total":860,"unchecked":0,"uncheckedKeysByFile":[],"unmatched":0,"updated":0},"startTime":1553879718172,"success":true,"wasInterrupted":false}}

{"testResults":{"assertionResults":[{"ancestorTitles":["Symbol in objects"],"failureMessages":[],"fullName":"Symbol in objects should compare objects with Symbol keys","location":null,"status":"passed","title":"should compare objects with Symbol keys"},{"ancestorTitles":["Symbol in objects"],"failureMessages":[],"fullName":"Symbol in objects should compare objects with mixed keys and Symbol","location":null,"status":"passed","title":"should compare objects with mixed keys and Symbol"},{"ancestorTitles":["Symbol in objects"],"failureMessages":[],"fullName":"Symbol in objects should compare objects with different Symbol keys","location":null,"status":"passed","title":"should compare objects with different Symbol keys"}],"endTime":1553879720058,"message":"","name":"/Users/scotthovestadt/jest/packages/expect/src/__tests__/symbolInObjects.test.js","startTime":1553879718871,"status":"passed","summary":""}}

{"testResults":{"assertionResults":[{"ancestorTitles":[],"failureMessages":[],"fullName":"stack trace points to correct location when using matchers","location":null,"status":"passed","title":"stack trace points to correct location when using matchers"},{"ancestorTitles":[],"failureMessages":[],"fullName":"stack trace points to correct location when using nested matchers","location":null,"status":"passed","title":"stack trace points to correct location when using nested matchers"},{"ancestorTitles":[],"failureMessages":[],"fullName":"stack trace points to correct location when throwing from a custom matcher","location":null,"status":"passed","title":"stack trace points to correct location when throwing from a custom matcher"}],"endTime":1553879720185,"message":"","name":"/Users/scotthovestadt/jest/packages/expect/src/__tests__/stacktrace.test.js","startTime":1553879718846,"status":"passed","summary":""}}

{"coverageMap":{"path":"/Users/scotthovestadt/jest/packages/jest-circus/src/utils.ts","statementMap":{"0":{"start":{"line":33,"column":19},"end":{"line":33,"column":70}},"1":{"start":{"line":35,"column":28},"end":{"line":54,"column":1}},"2":{"start":{"line":40,"column":14},"end":{"line":40,"column":18}},"3":{"start":{"line":41,"column":2},"end":{"line":44,"column":3}},"4":{"start":{"line":43,"column":4},"end":{"line":43,"column":24}},"5":{"start":{"line":46,"column":2},"end":{"line":53,"column":4}},"6":{"start":{"line":56,"column":24},"end":{"line":75,"column":2}},"7":{"start":{"line":63,"column":17},"end":{"line":75,"column":1}},"8":{"start":{"line":79,"column":23},"end":{"line":91,"column":1}},"9":{"start":{"line":80,"column":45},"end":{"line":80,"column":55}},"10":{"start":{"line":81,"column":29},"end":{"line":88,"column":3}},"11":{"start":{"line":83,"column":6},"end":{"line":87,"column":7}},"12":{"start":{"line":90,"column":2},"end":{"line":90,"column":75}},"13":{"start":{"line":93,"column":38},"end":{"line":116,"column":1}},"14":{"start":{"line":97,"column":6},"end":{"line":100,"column":3}},"15":{"start":{"line":102,"column":2},"end":{"line":113,"column":3}},"16":{"start":{"line":103,"column":4},"end":{"line":112,"column":5}},"17":{"start":{"line":104,"column":6},"end":{"line":111,"column":7}},"18":{"start":{"line":106,"column":10},"end":{"line":106,"column":38}},"19":{"start":{"line":107,"column":10},"end":{"line":107,"column":16}},"20":{"start":{"line":109,"column":10},"end":{"line":109,"column":37}},"21":{"start":{"line":110,"column":10},"end":{"line":110,"column":16}},"22":{"start":{"line":115,"column":2},"end":{"line":115,"column":16}},"23":{"start":{"line":118,"column":35},"end":{"line":142,"column":1}},"24":{"start":{"line":122,"column":6},"end":{"line":122,"column":37}},"25":{"start":{"line":123,"column":48},"end":{"line":123,"column":59}},"26":{"start":{"line":125,"column":2},"end":{"line":140,"column":35}},"27":{"start":{"line":126,"column":38},"end":{"line":126,"column":40}},"28":{"start":{"line":127,"column":4},"end":{"line":136,"column":5}},"29":{"start":{"line":128,"column":6},"end":{"line":135,"column":7}},"30":{"start":{"line":130,"column":10},"end":{"line":130,"column":47}},"31":{"start":{"line":131,"column":10},"end":{"line":131,"column":16}},"32":{"start":{"line":133,"column":10},"end":{"line":133,"column":38}},"33":{"start":{"line":134,"column":10},"end":{"line":134,"column":16}},"34":{"start":{"line":139,"column":4},"end":{"line":139,"column":77}},"35":{"start":{"line":141,"column":2},"end":{"line":141,"column":16}},"36":{"start":{"line":144,"column":37},"end":{"line":145,"column":76}},"37":{"start":{"line":145,"column":2},"end":{"line":145,"column":76}},"38":{"start":{"line":147,"column":28},"end":{"line":150,"column":101}},"39":{"start":{"line":148,"column":2},"end":{"line":150,"column":101}},"40":{"start":{"line":154,"column":35},"end":{"line":154,"column":41}},"41":{"start":{"line":157,"column":2},"end":{"line":157,"column":73}},"42":{"start":{"line":160,"column":33},"end":{"line":246,"column":1}},"43":{"start":{"line":166,"column":18},"end":{"line":166,"column":23}},"44":{"start":{"line":168,"column":2},"end":{"line":245,"column":7}},"45":{"start":{"line":169,"column":4},"end":{"line":172,"column":6}},"46":{"start":{"line":170,"column":12},"end":{"line":170,"column":58}},"47":{"start":{"line":176,"column":4},"end":{"line":195,"column":5}},"48":{"start":{"line":177,"column":19},"end":{"line":192,"column":7}},"49":{"start":{"line":178,"column":35},"end":{"line":180,"column":71}},"50":{"start":{"line":183,"column":8},"end":{"line":189,"column":9}},"51":{"start":{"line":184,"column":10},"end":{"line":186,"column":39}},"52":{"start":{"line":188,"column":10},"end":{"line":188,"column":35}},"53":{"start":{"line":191,"column":8},"end":{"line":191,"column":63}},"54":{"start":{"line":194,"column":6},"end":{"line":194,"column":40}},"55":{"start":{"line":198,"column":4},"end":{"line":206,"column":5}},"56":{"start":{"line":199,"column":6},"end":{"line":199,"column":43}},"57":{"start":{"line":201,"column":6},"end":{"line":205,"column":7}},"58":{"start":{"line":202,"column":8},"end":{"line":202,"column":45}},"59":{"start":{"line":204,"column":8},"end":{"line":204,"column":29}},"60":{"start":{"line":210,"column":4},"end":{"line":216,"column":5}},"61":{"start":{"line":215,"column":6},"end":{"line":215,"column":49}},"62":{"start":{"line":218,"column":4},"end":{"line":227,"column":5}},"63":{"start":{"line":219,"column":6},"end":{"line":226,"column":8}},"64":{"start":{"line":231,"column":4},"end":{"line":231,"column":21}},"65":{"start":{"line":234,"column":6},"end":{"line":234,"column":23}},"66":{"start":{"line":237,"column":6},"end":{"line":237,"column":43}},"67":{"start":{"line":238,"column":6},"end":{"line":238,"column":30}},"68":{"start":{"line":241,"column":6},"end":{"line":241,"column":23}},"69":{"start":{"line":242,"column":6},"end":{"line":242,"column":43}},"70":{"start":{"line":243,"column":6},"end":{"line":243,"column":30}},"71":{"start":{"line":244,"column":6},"end":{"line":244,"column":18}},"72":{"start":{"line":248,"column":31},"end":{"line":251,"column":1}},"73":{"start":{"line":249,"column":22},"end":{"line":249,"column":26}},"74":{"start":{"line":250,"column":2},"end":{"line":250,"column":71}},"75":{"start":{"line":253,"column":29},"end":{"line":259,"column":2}},"76":{"start":{"line":256,"column":17},"end":{"line":259,"column":1}},"77":{"start":{"line":261,"column":24},"end":{"line":308,"column":1}},"78":{"start":{"line":262,"column":40},"end":{"line":262,"column":50}},"79":{"start":{"line":263,"column":33},"end":{"line":263,"column":35}},"80":{"start":{"line":264,"column":2},"end":{"line":301,"column":3}},"81":{"start":{"line":265,"column":21},"end":{"line":265,"column":23}},"82":{"start":{"line":266,"column":44},"end":{"line":266,"column":48}},"83":{"start":{"line":267,"column":4},"end":{"line":269,"column":39}},"84":{"start":{"line":268,"column":6},"end":{"line":268,"column":36}},"85":{"start":{"line":271,"column":21},"end":{"line":271,"column":25}},"86":{"start":{"line":273,"column":4},"end":{"line":275,"column":5}},"87":{"start":{"line":274,"column":6},"end":{"line":274,"column":71}},"88":{"start":{"line":277,"column":19},"end":{"line":277,"column":23}},"89":{"start":{"line":278,"column":4},"end":{"line":291,"column":5}},"90":{"start":{"line":279,"column":24},"end":{"line":279,"column":60}},"91":{"start":{"line":280,"column":25},"end":{"line":280,"column":56}},"92":{"start":{"line":281,"column":6},"end":{"line":290,"column":7}},"93":{"start":{"line":286,"column":8},"end":{"line":289,"column":10}},"94":{"start":{"line":293,"column":4},"end":{"line":300,"column":7}},"95":{"start":{"line":303,"column":2},"end":{"line":305,"column":3}},"96":{"start":{"line":304,"column":4},"end":{"line":304,"column":61}},"97":{"start":{"line":307,"column":2},"end":{"line":307,"column":21}},"98":{"start":{"line":312,"column":25},"end":{"line":321,"column":1}},"99":{"start":{"line":313,"column":17},"end":{"line":313,"column":19}},"100":{"start":{"line":314,"column":42},"end":{"line":314,"column":46}},"101":{"start":{"line":315,"column":2},"end":{"line":317,"column":37}},"102":{"start":{"line":316,"column":4},"end":{"line":316,"column":32}},"103":{"start":{"line":319,"column":2},"end":{"line":319,"column":17}},"104":{"start":{"line":320,"column":2},"end":{"line":320,"column":26}},"105":{"start":{"line":323,"column":21},"end":{"line":349,"column":1}},"106":{"start":{"line":329,"column":2},"end":{"line":335,"column":3}},"107":{"start":{"line":330,"column":4},"end":{"line":330,"column":22}},"108":{"start":{"line":331,"column":4},"end":{"line":331,"column":27}},"109":{"start":{"line":333,"column":4},"end":{"line":333,"column":19}},"110":{"start":{"line":334,"column":4},"end":{"line":334,"column":29}},"111":{"start":{"line":337,"column":2},"end":{"line":344,"column":3}},"112":{"start":{"line":338,"column":4},"end":{"line":340,"column":5}},"113":{"start":{"line":339,"column":6},"end":{"line":339,"column":25}},"114":{"start":{"line":341,"column":4},"end":{"line":343,"column":5}},"115":{"start":{"line":342,"column":6},"end":{"line":342,"column":27}},"116":{"start":{"line":346,"column":2},"end":{"line":346,"column":71}},"117":{"start":{"line":348,"column":2},"end":{"line":348,"column":26}},"118":{"start":{"line":351,"column":47},"end":{"line":363,"column":1}},"119":{"start":{"line":356,"column":2},"end":{"line":358,"column":3}},"120":{"start":{"line":357,"column":4},"end":{"line":357,"column":42}},"121":{"start":{"line":360,"column":2},"end":{"line":362,"column":3}},"122":{"start":{"line":361,"column":4},"end":{"line":361,"column":62}},"123":{"start":{"line":365,"column":25},"end":{"line":369,"column":1}},"124":{"start":{"line":366,"column":2},"end":{"line":368,"column":3}},"125":{"start":{"line":367,"column":4},"end":{"line":367,"column":29}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":35,"column":28},"end":{"line":35,"column":29}},"loc":{"start":{"line":39,"column":20},"end":{"line":54,"column":1}},"line":39},"1":{"name":"(anonymous_1)","decl":{"start":{"line":56,"column":24},"end":{"line":56,"column":25}},"loc":{"start":{"line":63,"column":17},"end":{"line":75,"column":1}},"line":63},"2":{"name":"(anonymous_2)","decl":{"start":{"line":79,"column":23},"end":{"line":79,"column":24}},"loc":{"start":{"line":79,"column":66},"end":{"line":91,"column":1}},"line":79},"3":{"name":"(anonymous_3)","decl":{"start":{"line":82,"column":4},"end":{"line":82,"column":5}},"loc":{"start":{"line":83,"column":6},"end":{"line":87,"column":7}},"line":83},"4":{"name":"(anonymous_4)","decl":{"start":{"line":93,"column":38},"end":{"line":93,"column":39}},"loc":{"start":{"line":93,"column":67},"end":{"line":116,"column":1}},"line":93},"5":{"name":"(anonymous_5)","decl":{"start":{"line":118,"column":35},"end":{"line":118,"column":36}},"loc":{"start":{"line":118,"column":56},"end":{"line":142,"column":1}},"line":118},"6":{"name":"(anonymous_6)","decl":{"start":{"line":144,"column":37},"end":{"line":144,"column":38}},"loc":{"start":{"line":145,"column":2},"end":{"line":145,"column":76}},"line":145},"7":{"name":"(anonymous_7)","decl":{"start":{"line":147,"column":28},"end":{"line":147,"column":29}},"loc":{"start":{"line":148,"column":2},"end":{"line":150,"column":101}},"line":148},"8":{"name":"checkIsError","decl":{"start":{"line":156,"column":9},"end":{"line":156,"column":21}},"loc":{"start":{"line":156,"column":50},"end":{"line":158,"column":1}},"line":156},"9":{"name":"(anonymous_9)","decl":{"start":{"line":160,"column":33},"end":{"line":160,"column":34}},"loc":{"start":{"line":164,"column":19},"end":{"line":246,"column":1}},"line":164},"10":{"name":"(anonymous_10)","decl":{"start":{"line":168,"column":21},"end":{"line":168,"column":22}},"loc":{"start":{"line":168,"column":42},"end":{"line":232,"column":3}},"line":168},"11":{"name":"(anonymous_11)","decl":{"start":{"line":170,"column":6},"end":{"line":170,"column":7}},"loc":{"start":{"line":170,"column":12},"end":{"line":170,"column":58}},"line":170},"12":{"name":"(anonymous_12)","decl":{"start":{"line":177,"column":19},"end":{"line":177,"column":20}},"loc":{"start":{"line":177,"column":54},"end":{"line":192,"column":7}},"line":177},"13":{"name":"(anonymous_13)","decl":{"start":{"line":233,"column":10},"end":{"line":233,"column":11}},"loc":{"start":{"line":233,"column":16},"end":{"line":239,"column":5}},"line":233},"14":{"name":"(anonymous_14)","decl":{"start":{"line":240,"column":11},"end":{"line":240,"column":12}},"loc":{"start":{"line":240,"column":20},"end":{"line":245,"column":5}},"line":240},"15":{"name":"(anonymous_15)","decl":{"start":{"line":248,"column":31},"end":{"line":248,"column":32}},"loc":{"start":{"line":248,"column":67},"end":{"line":251,"column":1}},"line":248},"16":{"name":"(anonymous_16)","decl":{"start":{"line":253,"column":29},"end":{"line":253,"column":30}},"loc":{"start":{"line":256,"column":17},"end":{"line":259,"column":1}},"line":256},"17":{"name":"(anonymous_17)","decl":{"start":{"line":261,"column":24},"end":{"line":261,"column":25}},"loc":{"start":{"line":261,"column":71},"end":{"line":308,"column":1}},"line":261},"18":{"name":"(anonymous_18)","decl":{"start":{"line":312,"column":25},"end":{"line":312,"column":26}},"loc":{"start":{"line":312,"column":46},"end":{"line":321,"column":1}},"line":312},"19":{"name":"(anonymous_19)","decl":{"start":{"line":323,"column":21},"end":{"line":323,"column":22}},"loc":{"start":{"line":325,"column":13},"end":{"line":349,"column":1}},"line":325},"20":{"name":"(anonymous_20)","decl":{"start":{"line":351,"column":47},"end":{"line":351,"column":48}},"loc":{"start":{"line":355,"column":5},"end":{"line":363,"column":1}},"line":355},"21":{"name":"(anonymous_21)","decl":{"start":{"line":365,"column":25},"end":{"line":365,"column":26}},"loc":{"start":{"line":365,"column":67},"end":{"line":369,"column":1}},"line":365}},"branchMap":{"0":{"loc":{"start":{"line":41,"column":2},"end":{"line":44,"column":3}},"type":"if","locations":[{"start":{"line":41,"column":2},"end":{"line":44,"column":3}},{"start":{"line":41,"column":2},"end":{"line":44,"column":3}}],"line":41},"1":{"loc":{"start":{"line":41,"column":6},"end":{"line":41,"column":21}},"type":"binary-expr","locations":[{"start":{"line":41,"column":6},"end":{"line":41,"column":12}},{"start":{"line":41,"column":16},"end":{"line":41,"column":21}}],"line":41},"2":{"loc":{"start":{"line":84,"column":8},"end":{"line":86,"column":67}},"type":"binary-expr","locations":[{"start":{"line":84,"column":8},"end":{"line":84,"column":28}},{"start":{"line":85,"column":9},"end":{"line":85,"column":24}},{"start":{"line":85,"column":28},"end":{"line":85,"column":48}},{"start":{"line":86,"column":9},"end":{"line":86,"column":24}},{"start":{"line":86,"column":28},"end":{"line":86,"column":66}}],"line":84},"3":{"loc":{"start":{"line":90,"column":9},"end":{"line":90,"column":74}},"type":"binary-expr","locations":[{"start":{"line":90,"column":9},"end":{"line":90,"column":27}},{"start":{"line":90,"column":31},"end":{"line":90,"column":74}}],"line":90},"4":{"loc":{"start":{"line":102,"column":2},"end":{"line":113,"column":3}},"type":"if","locations":[{"start":{"line":102,"column":2},"end":{"line":113,"column":3}},{"start":{"line":102,"column":2},"end":{"line":113,"column":3}}],"line":102},"5":{"loc":{"start":{"line":104,"column":6},"end":{"line":111,"column":7}},"type":"switch","locations":[{"start":{"line":105,"column":8},"end":{"line":107,"column":16}},{"start":{"line":108,"column":8},"end":{"line":110,"column":16}}],"line":104},"6":{"loc":{"start":{"line":128,"column":6},"end":{"line":135,"column":7}},"type":"switch","locations":[{"start":{"line":129,"column":8},"end":{"line":131,"column":16}},{"start":{"line":132,"column":8},"end":{"line":134,"column":16}}],"line":128},"7":{"loc":{"start":{"line":145,"column":2},"end":{"line":145,"column":76}},"type":"binary-expr","locations":[{"start":{"line":145,"column":2},"end":{"line":145,"column":27}},{"start":{"line":145,"column":31},"end":{"line":145,"column":76}}],"line":145},"8":{"loc":{"start":{"line":149,"column":4},"end":{"line":149,"column":28}},"type":"cond-expr","locations":[{"start":{"line":149,"column":13},"end":{"line":149,"column":19}},{"start":{"line":149,"column":22},"end":{"line":149,"column":28}}],"line":149},"9":{"loc":{"start":{"line":157,"column":12},"end":{"line":157,"column":71}},"type":"binary-expr","locations":[{"start":{"line":157,"column":12},"end":{"line":157,"column":17}},{"start":{"line":157,"column":21},"end":{"line":157,"column":45}},{"start":{"line":157,"column":49},"end":{"line":157,"column":71}}],"line":157},"10":{"loc":{"start":{"line":176,"column":4},"end":{"line":195,"column":5}},"type":"if","locations":[{"start":{"line":176,"column":4},"end":{"line":195,"column":5}},{"start":{"line":176,"column":4},"end":{"line":195,"column":5}}],"line":176},"11":{"loc":{"start":{"line":178,"column":35},"end":{"line":180,"column":71}},"type":"cond-expr","locations":[{"start":{"line":179,"column":12},"end":{"line":179,"column":18}},{"start":{"line":180,"column":12},"end":{"line":180,"column":71}}],"line":178},"12":{"loc":{"start":{"line":183,"column":8},"end":{"line":189,"column":9}},"type":"if","locations":[{"start":{"line":183,"column":8},"end":{"line":189,"column":9}},{"start":{"line":183,"column":8},"end":{"line":189,"column":9}}],"line":183},"13":{"loc":{"start":{"line":183,"column":12},"end":{"line":183,"column":31}},"type":"binary-expr","locations":[{"start":{"line":183,"column":12},"end":{"line":183,"column":21}},{"start":{"line":183,"column":25},"end":{"line":183,"column":31}}],"line":183},"14":{"loc":{"start":{"line":191,"column":15},"end":{"line":191,"column":62}},"type":"cond-expr","locations":[{"start":{"line":191,"column":24},"end":{"line":191,"column":50}},{"start":{"line":191,"column":53},"end":{"line":191,"column":62}}],"line":191},"15":{"loc":{"start":{"line":198,"column":4},"end":{"line":206,"column":5}},"type":"if","locations":[{"start":{"line":198,"column":4},"end":{"line":206,"column":5}},{"start":{"line":198,"column":4},"end":{"line":206,"column":5}}],"line":198},"16":{"loc":{"start":{"line":210,"column":4},"end":{"line":216,"column":5}},"type":"if","locations":[{"start":{"line":210,"column":4},"end":{"line":216,"column":5}},{"start":{"line":210,"column":4},"end":{"line":216,"column":5}}],"line":210},"17":{"loc":{"start":{"line":211,"column":6},"end":{"line":213,"column":46}},"type":"binary-expr","locations":[{"start":{"line":211,"column":6},"end":{"line":211,"column":39}},{"start":{"line":212,"column":6},"end":{"line":212,"column":28}},{"start":{"line":213,"column":6},"end":{"line":213,"column":46}}],"line":211},"18":{"loc":{"start":{"line":218,"column":4},"end":{"line":227,"column":5}},"type":"if","locations":[{"start":{"line":218,"column":4},"end":{"line":227,"column":5}},{"start":{"line":218,"column":4},"end":{"line":227,"column":5}}],"line":218},"19":{"loc":{"start":{"line":218,"column":8},"end":{"line":218,"column":43}},"type":"binary-expr","locations":[{"start":{"line":218,"column":8},"end":{"line":218,"column":15}},{"start":{"line":218,"column":19},"end":{"line":218,"column":43}}],"line":218},"20":{"loc":{"start":{"line":237,"column":6},"end":{"line":237,"column":42}},"type":"binary-expr","locations":[{"start":{"line":237,"column":6},"end":{"line":237,"column":21}},{"start":{"line":237,"column":25},"end":{"line":237,"column":42}}],"line":237},"21":{"loc":{"start":{"line":242,"column":6},"end":{"line":242,"column":42}},"type":"binary-expr","locations":[{"start":{"line":242,"column":6},"end":{"line":242,"column":21}},{"start":{"line":242,"column":25},"end":{"line":242,"column":42}}],"line":242},"22":{"loc":{"start":{"line":250,"column":9},"end":{"line":250,"column":70}},"type":"cond-expr","locations":[{"start":{"line":250,"column":41},"end":{"line":250,"column":63}},{"start":{"line":250,"column":66},"end":{"line":250,"column":70}}],"line":250},"23":{"loc":{"start":{"line":273,"column":4},"end":{"line":275,"column":5}},"type":"if","locations":[{"start":{"line":273,"column":4},"end":{"line":275,"column":5}},{"start":{"line":273,"column":4},"end":{"line":275,"column":5}}],"line":273},"24":{"loc":{"start":{"line":278,"column":4},"end":{"line":291,"column":5}},"type":"if","locations":[{"start":{"line":278,"column":4},"end":{"line":291,"column":5}},{"start":{"line":278,"column":4},"end":{"line":291,"column":5}}],"line":278},"25":{"loc":{"start":{"line":281,"column":6},"end":{"line":290,"column":7}},"type":"if","locations":[{"start":{"line":281,"column":6},"end":{"line":290,"column":7}},{"start":{"line":281,"column":6},"end":{"line":290,"column":7}}],"line":281},"26":{"loc":{"start":{"line":282,"column":8},"end":{"line":284,"column":43}},"type":"binary-expr","locations":[{"start":{"line":282,"column":8},"end":{"line":282,"column":18}},{"start":{"line":283,"column":8},"end":{"line":283,"column":45}},{"start":{"line":284,"column":8},"end":{"line":284,"column":43}}],"line":282},"27":{"loc":{"start":{"line":329,"column":2},"end":{"line":335,"column":3}},"type":"if","locations":[{"start":{"line":329,"column":2},"end":{"line":335,"column":3}},{"start":{"line":329,"column":2},"end":{"line":335,"column":3}}],"line":329},"28":{"loc":{"start":{"line":337,"column":2},"end":{"line":344,"column":3}},"type":"if","locations":[{"start":{"line":337,"column":2},"end":{"line":344,"column":3}},{"start":{"line":337,"column":2},"end":{"line":344,"column":3}}],"line":337},"29":{"loc":{"start":{"line":338,"column":4},"end":{"line":340,"column":5}},"type":"if","locations":[{"start":{"line":338,"column":4},"end":{"line":340,"column":5}},{"start":{"line":338,"column":4},"end":{"line":340,"column":5}}],"line":338},"30":{"loc":{"start":{"line":341,"column":4},"end":{"line":343,"column":5}},"type":"if","locations":[{"start":{"line":341,"column":4},"end":{"line":343,"column":5}},{"start":{"line":341,"column":4},"end":{"line":343,"column":5}}],"line":341},"31":{"loc":{"start":{"line":366,"column":2},"end":{"line":368,"column":3}},"type":"if","locations":[{"start":{"line":366,"column":2},"end":{"line":368,"column":3}},{"start":{"line":366,"column":2},"end":{"line":368,"column":3}}],"line":366}},"s":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":0,"24":0,"25":0,"26":0,"27":0,"28":0,"29":0,"30":0,"31":0,"32":0,"33":0,"34":0,"35":0,"36":0,"37":0,"38":0,"39":0,"40":0,"41":0,"42":0,"43":0,"44":0,"45":0,"46":0,"47":0,"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0,"58":0,"59":0,"60":0,"61":0,"62":0,"63":0,"64":0,"65":0,"66":0,"67":0,"68":0,"69":0,"70":0,"71":0,"72":0,"73":0,"74":0,"75":0,"76":0,"77":0,"78":0,"79":0,"80":0,"81":0,"82":0,"83":0,"84":0,"85":0,"86":0,"87":0,"88":0,"89":0,"90":0,"91":0,"92":0,"93":0,"94":0,"95":0,"96":0,"97":0,"98":0,"99":0,"100":0,"101":0,"102":0,"103":0,"104":0,"105":0,"106":0,"107":0,"108":0,"109":0,"110":0,"111":0,"112":0,"113":0,"114":0,"115":0,"116":0,"117":0,"118":0,"119":0,"120":0,"121":0,"122":0,"123":0,"124":0,"125":0},"f":{"0":0,"1":0,"2":0,"3":0,"4":0,"5":0,"6":0,"7":0,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0},"b":{"0":[0,0],"1":[0,0],"2":[0,0,0,0,0],"3":[0,0],"4":[0,0],"5":[0,0],"6":[0,0],"7":[0,0],"8":[0,0],"9":[0,0,0],"10":[0,0],"11":[0,0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[0,0],"16":[0,0],"17":[0,0,0],"18":[0,0],"19":[0,0],"20":[0,0],"21":[0,0],"22":[0,0],"23":[0,0],"24":[0,0],"25":[0,0],"26":[0,0,0],"27":[0,0],"28":[0,0],"29":[0,0],"30":[0,0],"31":[0,0]}}}

Test plan

  • All tests continue to pass.
  • Built a real integration against this.
  • WIP: adding a few json-line specific tests

@@ -32,7 +34,10 @@ function summarize(coverageMap: CoverageMap): CoverageMap {
}
}

summaries[file] = covered.join('');
summaries[file] = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a breaking change to jest-phabricator, necessary to support the JSON lines format.

Technically, before it was breaking the contract provided by TypeScript by just returning an any... I've typed it correctly now.

@@ -19,6 +18,8 @@ import {Config} from '@jest/types';
import {
AggregatedResult,
makeEmptyAggregatedTestResult,
formatTestResult,
formatTestResults,
} from '@jest/test-result';
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why weren't these being imported from @jest/test-result before?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed it when refactoring. Will be good to trim out exports from jest-util for 25

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing changelog 😀
I'm also missing a test or two, but the implementation looks solid to me 👌

@@ -253,9 +337,10 @@ export default (async function runJest({
await runGlobalHook({allTests, globalConfig, moduleName: 'globalTeardown'});
}

return processResults(results, {
return await processResults(results, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's now async, since for JSON lines it'll now wait on stdout for buffering output.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whole function is async already, awaiting here just creates an extra promise instead of returning the promise from processResults

@thymikee
Copy link
Collaborator

thymikee commented Mar 30, 2019

Looks good! Do you think it makes sense having this as a reporter as well?

@github-actions
Copy link

github-actions bot commented Sep 8, 2022

This PR is stale because it has been open 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.

@github-actions github-actions bot added the Stale label Sep 8, 2022
@github-actions
Copy link

github-actions bot commented Oct 8, 2022

This PR was closed because it has been stalled for 30 days with no activity. Please open a new PR if the issue is still relevant, linking to this one.

@github-actions github-actions bot closed this Oct 8, 2022
@github-actions
Copy link

github-actions bot commented Nov 8, 2022

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants