Coverage data was not found when using "--collectCoverageFrom"
See original GitHub issueDo you want to request a feature or report a bug? Bug
What is the current behavior?
When I’m using the Jest CLI like this:
jest --coverage --collectCoverageFrom "_path of a file_"
I get this error: Jest: Coverage data for global was not found.
My goal is to execute the coverage only on some files.
If the current behavior is a bug, please provide the steps to reproduce and
either a repl.it demo through https://repl.it/languages/jest or a minimal
repository on GitHub that we can yarn install
and yarn test
.
Repl.it don’t seems to work, but just type
jest --coverage --collectCoverageFrom "_path of a file_"
What is the expected behavior? Display the coverage table of the files specified by the collectCoverageFrom option.
Please provide your exact Jest configuration and mention your Jest, node,
yarn/npm version and operating system.
"jest": { "collectCoverage": true, "collectCoverageFrom": [ "src/**/*.js" ], "coverageThreshold": { "global": { "branches": 100, "functions": 100, "lines": 100, "statements": 0 } }, "moduleFileExtensions": [ "js" ], }
Jest 22.2.2 Node 8.9.4 yarn 1.3.2 macOS 10.13.4
Thanks!
Issue Analytics
- State:
- Created 6 years ago
- Comments:13 (5 by maintainers)
Top GitHub Comments
@noelebrun Did you solved this problem?
I currently facing the same error with my typescript ts-jest setup.
This is my config:
And this is the console output:
I also tried to provide
coverageDirectory
, but without any change to the error message.My dependencies:
There are no tests in that repo though. Adding a dummy test gives the following output:
I suppose we could improve the message when there are no tests, or just skip the coverage report when there are none?