-
-
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
Configuration file equivalent for --passWithNoTests flag #8896
Comments
@SimenB I can pick this up, if this feature is needed |
Will this be added? @M4rk9696 Thanks! |
So... That is not going to happen? |
Any progress? |
need this |
+1 |
7 similar comments
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
+1 |
Isn't this something which was addressed in Jest 22 in #4639 ?
A quick test in Jest 27 just now seems to show this working properly. $> jest --version
27.4.7
$> jest
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In \repos\project
14 files checked.
testMatch: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[tj]s?(x)'] - 0 matches
testPathIgnorePatterns: \\node_modules\\ - 14 matches
testRegex: - 0 matches
Pattern: - 0 matches
$> jest --config='{\"testMatch\":[\"*.js\"]}'
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In \repos\project
14 files checked.
testMatch: *.js - 0 matches
testPathIgnorePatterns: \\node_modules\\ - 14 matches
testRegex: - 0 matches
Pattern: - 0 matches
$> jest --config='{\"testMatch\":[\"*.js\"]}' --passWithNoTests
No tests found, exiting with code 0
$> jest --config='{\"testMatch\":[\"*.js\"],\"passWithNoTests\":true}'
No tests found, exiting with code 0
$> echo '{"testMatch": ["*.js"],"passWithNoTests": true}' > jest.config.json && jest
No tests found, exiting with code 0
$> echo '{"testMatch": ["*.js"]}' > jest.config.json && jest
No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In \repos\project
14 files checked.
testMatch: *.js - 0 matches
testPathIgnorePatterns: \\node_modules\\ - 14 matches
testRegex: - 0 matches
Pattern: - 0 matches Am I missing something ? |
Quoting:
Hrm odd, actually using a config file with
$ npx jest --version |
Needing this too! |
Really needing this too!!! @Mark1626 any news? |
Works for me as well (29.4.3). It seems it was just forgotten to add to the documentation. |
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. |
+1 |
It's undocumented, see jestjs/jest#8896
🚀 Feature Proposal
Add a
passWithNoTests
boolean support in the configuration file, to have the same effect as the--passWithNoTests
CLI flag.Motivation
We currently use a shared configuration file across our organization, so that every repo running Jest will have the same default configuration (we do the same for Prettier, TSLint, Webpack, etc.). This ensures consistency, avoids surprises, and lets our teams have a sort of internal "zero conf" set up with the preferences/settings of the engineering organization.
This works really well with Jest, except we are now adding
--passWithNoTests
to all our new repos, where a configuration file equivalent would let us do it once.Example
In
jest.config.js
(if using the JS format):The text was updated successfully, but these errors were encountered: