Do not fail on 'Jest: Coverage data for ... was not found.' or make `coverageThreshold` configurable on the cli
See original GitHub issue🚀 Feature Proposal
We are using one jest.config.js
per application and using Bazel as the build/testing tool. The setup there works that each test file will be invoked in isolation/sandboxed via jest. So as soon as I have coverageThreshold: { './some/path/': {...} }
some of these test will fail with Jest: Coverage data for ... was not found.
Now I could point them all to their individual config, but then I would have to create many many more file which all would be identical apart from the coverageThreshold
.
So it would be great to either get a passWithNoCoverage
flag or similar, or make coverageThreshold
configurable on the cli, so I could just pass that in for each individual jest invocations
Motivation
So I do not have to have duplicate jest.config files
Example
either:
jest --passWithNoCoverage --config=path/to/config.js --runTestsByPath=path/to/test.js
or
jest --coverageThreshold='{\"global\":{\"statements\":90}' --config=path/to/config.js --runTestsByPath=path/to/test.js
Pitch
One of the proposals might even be a bug report, see: https://github.com/facebook/jest/issues/7509 and the addition of the new flag would imo be a good fit to complement the already existing --passWithNoTests
flag.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:5
- Comments:12
Our use case is: 1) coverage threshold set, and 2) prepush hook that runs Jest with
--changedSince=master
to reduce test execution time, since the prepush hook is about getting quick feedback before a full CI run, and 3) not an option for us to run with--no-coverage
because meeting our coverage threshold is important if tests are run.However, I would expect
--passWithNoTests
to also imply that Jest should pass with no coverage, since there’s no way that a coverage threshold could ever be met if no tests ran.Absolutely still an issue.