Fix console reporter#8739
Conversation
a399e45 to
e2ba80f
Compare
| // Release memory if unused later. | ||
| testResult.sourceMaps = undefined; | ||
| testResult.coverage = undefined; | ||
| testResult.console = undefined; |
There was a problem hiding this comment.
I don't think this is the correct approach, see #8233 (especially the discussion about it breaking reporters)
/cc @scotthovestadt
There was a problem hiding this comment.
Hmm - would be great to remove console completely from the TestResults type then if it's functionally always set to undefined.
A lot of users of jest-junit want to include console output in the junit.xml output (which is compliant junit) but that's not possible without this change.
There was a problem hiding this comment.
yeah, we could maybe do a delete. Should deffo fix the typings if they are off. And clarify in the docs 🙂
(this was also probably a breaking change...)
|
Another interesting find is that there is zero possibility of console output in reporters if you only have one test. I think due to https://github.com/facebook/jest/blob/master/packages/jest-core/src/runJest.ts#L230 @SimenB can you think of a reason to set verbose to true if there is only 1 test? The CustomConsole (which gets called if verbose is true) doesn't buffer console output and always returns undefined when getBuffer is called. |
|
It's set to verbose so you see every single test title. Not sure if useful or not... |
|
I'll close this PR for now - with the approach listed in the issue you linked I was able to get console output showing in jest-junit. |
|
Gives a good reason now for folks to use jest-junit as a reporter instead of a testResultsProcessor I guess :) |
|
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. |
Summary
Fixes a bug that set result.console to undefined for jest reporters. Seen here.
jest-community/jest-junit#45
#8499
Test plan
See that a jest reporter shows console data for suites with > 1 test.