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

Verbose reporter buffers writes preventing debugging with logs #11299

Closed
conartist6 opened this issue Apr 14, 2021 · 6 comments
Closed

Verbose reporter buffers writes preventing debugging with logs #11299

conartist6 opened this issue Apr 14, 2021 · 6 comments

Comments

@conartist6
Copy link
Contributor

Opening an issue because I don't know how to get any traction on my PR.

Currently you have two choices with jest: you can debug using console logs or you can debug using a debugger. If you are using a debugger though you will not see output from any console.log statements that run. This is the kind of bug that I hate most because it makes you feel insane, especially since the behavior is undocumented and my investigation indicates that it seems to be an unintentional regression.

Please please someone take notice?

@conartist6
Copy link
Contributor Author

conartist6 commented Apr 14, 2021

To repro put the following in any test: console.log('foo'); debugger; and run with the command:

node --inspect ./node_modules/.bin/jest path/to/test.js

If only one test file matches jest uses the verbose debugger, which makes sense -- when no output interleaving is needed the buffering and output interleaving code is unneeded.

This leads us to the reasonable expectation that foo is seen in the console when the debugger is hit. Actually foo is only seen in the console once evaluation of the test case is completed.

@silverwind
Copy link
Contributor

silverwind commented Apr 30, 2021

I observe a similar issue where console.log from the application is not visible with verbose: false during interactive tests (--watchAll=true). If I set verbose: true in the config, the console.logs from the application show up again at the cost of overly verbose jest output. Can you confirm this is the same issue?

@conartist6
Copy link
Contributor Author

I don't think it is the same issue, no. Could you share what the "overly verbose" output looks like?

@silverwind
Copy link
Contributor

silverwind commented May 1, 2021

With "overly verbose" I just meant the one-test-per-line output of verbose: true which I hate. Maybe I will set up a simple test case for what I mean later. Primary issue is I have to turn on verbose to be able to see some console.log output.

@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
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 Mar 20, 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

3 participants