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

ReporterDispatcher set result.console to undefined #8499

Closed
jkblume opened this issue May 28, 2019 · 7 comments
Closed

ReporterDispatcher set result.console to undefined #8499

jkblume opened this issue May 28, 2019 · 7 comments

Comments

@jkblume
Copy link

jkblume commented May 28, 2019

🐛 Bug Report

The ReporterDispatcher overrides TestResult.console property with undefined. As a result of this - the console output cannot be used in custom reporters like jest-junit.

To Reproduce

This behaviour is visible in the source code in version @jest core 24.8.0.

Line 43:
https://github.com/facebook/jest/blob/master/packages/jest-core/src/ReporterDispatcher.ts

    // Release memory if unused later.
    testResult.sourceMaps = undefined;
    testResult.coverage = undefined;
    testResult.console = undefined;

Expected behavior

The console output should be forwarded to the test reporters. But first we have to check for what reason the console property is set to undefined.

Link to repl or repo (highly encouraged)

Steps to reproduce the 'error':

If you debug the code or add some debug outputs you notice that the TestResult.console property is defined - but after passing the ReporterDispatcher it is set to undefined

@brownbl1
Copy link

I'm seeing this as well.

@palmerj3
Copy link
Contributor

I think I have a fix for jest to re-enable this functionality. Sending a PR shortly.

@SimenB
Copy link
Member

SimenB commented Jul 23, 2019

I missed this issue, sorry! Background is in #8233. Essentially - if you need the console output at the end of a run, buffer it yourself on a test by test basis.

There's most probably some faulty types here that could have made that error visible, at least to TS users.

@hmschreiner
Copy link

Any updates on this, @SimenB?

I'm trying to create a custom reporter to sets a max warning threshold like --max-warnings on lint, but I can't figure out if the console is being called if the return of result.console is undefined.

@github-actions
Copy link

This issue is stale because it has been open for 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 Feb 17, 2023
@github-actions
Copy link

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

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2023
@github-actions
Copy link

This issue 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 Apr 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants