-
-
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
Misleading message for passWithNoTests. #8187
Comments
There's a reason we ask for reproductions - this works like it should in Jest's repo: $ y jest blahblah
yarn run v1.15.0
$ node ./packages/jest-cli/bin/jest.js blahblah
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In /Users/simen/Development/jest
2151 files checked across 14 projects. Run with `--verbose` for more details.
Pattern: blahblah - 0 matches
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ echo $?
1
$ y jest blahblah --passWithNoTests
yarn run v1.15.0
$ node ./packages/jest-cli/bin/jest.js blahblah --passWithNoTests
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In /Users/simen/Development/jest
2151 files checked across 14 projects. Run with `--verbose` for more details.
Pattern: blahblah - 0 matches
$ echo $?
0 Could you setup a reproduction and include what commands you run at their exit code? |
@SimenB You've reproduced it perfectly well! As the bug description says, the exit code is just fine in both scenarios. But in the latter one there should be no console message at all or it should be different. It did actually return 0, but says that it did return 1, etc. |
Ah, it's just the message! Gotcha, I thought you said the flag didn't work. Sorry about that. Yeah that's a bug 🙂 |
@SimenB Can I take this up 🙂 |
Yeah, go for it! |
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
The same message appears regardless of --passWithNoTest being specified or not:
No tests found, exiting with code 1
Run with --passWithNoTests to exit with code 0
Please note, that the response code is indeed correct: with --passWithNoTest it is 0, without - it is 1.
It's in runJest.ts line 204 or 215 - call to getNoTestsFoundMessage() function. Or in that function itself.
To Reproduce
Run jest against any project with no tests or no tests matching the pattern. See the console output.
Expected behavior
The printed message should reflect the reality. When no tests found and --passWithNoTests specified it should either not be present at all or should read:
No tests found, exiting with code 0
Link to repl or repo (highly encouraged)
N/A
Run
npx envinfo --preset jest
N/A
The text was updated successfully, but these errors were encountered: