-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Tests logging after teardown do not fail tests in non-watch mode #11132
Comments
I will take a look and send a PR for this in near future. |
Thanks @snitin315! |
@SimenB Can I take this if no one's working on it already? |
This comment was marked as outdated.
This comment was marked as outdated.
AFAIK this is still relevant - can't remember merging anything that should affect it at least 🙂 |
I'm experiencing the same issue - when running on my machine, I get the |
I also spent many hours trying to debug this. IMO the user experience of having no tests fail, but having the process exit with a non-0 status is extremely confusing. Is there any way to correlate logging with the test that may have issued the promise (or whatever) that caused the logging after cleanup? The other problem that I experienced is that it was quite difficult to definitively find which test was causing the issue. |
I also meet the problem. The jest show all tests is passed, however it return the exit code to 1 so it make my CI machine failed (this situation is appear mostly on CI machine and difficult to reproduce when running test on local). Also the error log can not help me to find the cause of the problem, I have no ideal how to handle this occasional fail test situation on my CI machine. P.S. The error message |
@snitin315 commented on Mar 1, 2021
Thumbs up! May the "near future" not be long away. |
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. |
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. |
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. |
🐛 Bug Report
#10728 sets the exit code to 1 when tests log after teardown. This correctly terminates the process if run in non-watch mode. However, if you do
jest --watch
then all tests are reported as passing, despite there being a warning:Additionally, I noticed that
console.warn
andconsole.error
don't cause failures - is that intended? I'm also happy to open a dedicated issue if you prefer keeping things isolated.To Reproduce
Steps to reproduce the behavior:
Given this test:
Run
yarn jest --watchAll
(or--watch
if running inside a git repo)Observe that Jest reports a passing test, although it does log a warning:
Now if you just run
yarn jest
, you'll see the process exits with exit code 1.Expected behavior
Jest should report a test failure.
Link to repl or repo (highly encouraged)
https://repl.it/@NMinhNguyen/jest-playground#sum.test.js
Note: you'll need to run it in watch mode:
yarn jest --watchAll
(--watchAll
since it's not inside a git repo).envinfo
The text was updated successfully, but these errors were encountered: