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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading message for passWithNoTests. #8187

Closed
Domratchev opened this issue Mar 21, 2019 · 7 comments
Closed

Misleading message for passWithNoTests. #8187

Domratchev opened this issue Mar 21, 2019 · 7 comments

Comments

@Domratchev
Copy link

馃悰 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

@SimenB
Copy link
Member

SimenB commented Mar 21, 2019

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?

@Domratchev
Copy link
Author

@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.

@SimenB
Copy link
Member

SimenB commented Mar 21, 2019

Ah, it's just the message! Gotcha, I thought you said the flag didn't work. Sorry about that.

Yeah that's a bug 馃檪

@j33n
Copy link

j33n commented Mar 22, 2019

@SimenB Can I take this up 馃檪

@SimenB
Copy link
Member

SimenB commented Mar 22, 2019

Yeah, go for it!

@SimenB
Copy link
Member

SimenB commented Jun 24, 2019

#8595

@SimenB SimenB closed this as completed Jun 24, 2019
@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 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants