You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When attempting to run tests against a directory that is nonexistent (or even a directory that exists, but does not contain any valid tests), the CLI exits 0.
Expected behavior
The CLI should exit nonzero when there is an error identifying tests.
Motivation
This is problematic for CI/automated environments where test success is determined based on exit code. Semantically, it is a valid error condition if CI isn't able to find any tests to run. This surfaced after performing a major refactor that changed a project's test directory structure, and CI still passed the build despite the jest step failing to identify any tests.
Minimally reproducible example
$ yarn add jest
$ mkdir test
$ ./node_modules/.bin/jest --verbose test
No tests found
In /path/to/test
6 files checked.
testMatch: **/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x) - 0 matches
testPathIgnorePatterns: /node_modules/ - 6 matches
Pattern: test - 0 matches
$ echo$?
0
The text was updated successfully, but these errors were encountered:
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.
This behavior is reproducible on
[email protected]
.Actual behavior
When attempting to run tests against a directory that is nonexistent (or even a directory that exists, but does not contain any valid tests), the CLI exits 0.
Expected behavior
The CLI should exit nonzero when there is an error identifying tests.
Motivation
This is problematic for CI/automated environments where test success is determined based on exit code. Semantically, it is a valid error condition if CI isn't able to find any tests to run. This surfaced after performing a major refactor that changed a project's test directory structure, and CI still passed the build despite the
jest
step failing to identify any tests.Minimally reproducible example
The text was updated successfully, but these errors were encountered: