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

jest doesn't print an error on a default settings #3893

Closed
capaj opened this issue Jun 23, 2017 · 4 comments
Closed

jest doesn't print an error on a default settings #3893

capaj opened this issue Jun 23, 2017 · 4 comments

Comments

@capaj
Copy link
Contributor

capaj commented Jun 23, 2017

So this was pretty annoying-we have a functional api test which runs our API(actually listening http server) and one of the tests were failing but without any info. The terminal looked like this:

image

it just ends and doesn't print anything.
So I dug into the codebase and tried fiddling with configs. I had a suspect- the famous BufferedConsole class that jest uses to make logs nice as they run in paralell. In couple of minutes, when I failed to try to remove console buffering I tried to set "useStderr": true,
and well fair enough now jest does print an error stack trace:

image

this was on jest 20.0.4 and node.js version 8.1.0. I did use a hard-rejection npm module to make my process crash any time a promise rejection is unhandled. Without this module my test did run into a timeout instead if crashig, but that is a subject of another issue I believe.

Why does useStderr default to false? Why would I even want to use the default value when it makes me blind in debugging my tests?
In the documentation this option is just described with a single short sentence which doesn't really capture the importance of this settings. How about something along the lines of:

if your test is failing without any error message you might want to turn this ON

@thymikee
Copy link
Collaborator

thymikee commented Jun 25, 2017

cc @aaronabramov who should be able to explain it nicely.

@aaronabramov
Copy link
Contributor

i'm pretty sure this should fix the issue #3895

the original problem was in that we had to additionally buffer and debounce stdout to avoid conflicting outputs with the concurrent test reporter that we have. Sometimes we ended up with process exiting before it had a chance to flush the debounced output.

stderr wasn't buffered or debounced, so switching to it fixed the problem in your case.

@aaronabramov
Copy link
Contributor

closing it, since the fix was merged already

@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 May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants