-
-
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
Improve the message when run coverage while there are no tests #6141
Comments
I'd like to try this if no one is on it 😄 |
Go for it :) |
I'm looking into this issue and I can't seem to reproduce the issue so I'm quite lost.
There is no sign of I also tried it with the
|
You need to include |
I did include coverage |
@misoguy I couldn't reproduce it too :(, I checked |
I am getting same issue here, my case has one more option: |
I could reproduce @zlk89 case, it seems that there is something unstable here.
|
I am getting same issue here, my case only in watch mode pakage.json...
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "/tests/.*\\.spec\\.tsx?$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"collectCoverage": true,
"coverageDirectory": "coverage",
"coverageThreshold": {
"global": {
"branches": 80,
"functions": 80,
"lines": 80,
"statements": -10
}
}
},
... bash Jest$ npx jest --watch
No tests found related to files changed since last commit.
Press `a` to run all tests, or run Jest with `--watchAll`.
----------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------|----------|----------|----------|----------|-------------------|
All files | 0 | 0 | 0 | 0 | |
----------|----------|----------|----------|----------|-------------------|
Jest: Coverage data for global was not found. bash envinfo$ npx envinfo --preset jest
System:
OS: macOS Sierra 10.12.6
CPU: x64 Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz
Binaries:
Node: 10.0.0 - /usr/local/bin/node
Yarn: 1.6.0 - /usr/local/bin/yarn
npm: 6.0.1 - /usr/local/bin/npm
npmPackages:
@types/jest: ^22.2.3 => 22.2.3
jest: ^22.4.3 => 22.4.3 |
@misoguy kindly ask if there is any update on this? |
@zlk89 I'm sorry, lately I didn't really find time... Feel free to take this issue if you'd like, if not I'll try to find time to tackle this issue soon 😄 |
I also want to try it too but it won't be done quickly, I'm new to Jest codebase :) and it seems that the issue happens with many cases. |
Here's where that error is thrown, should be able to add the check you need somewhere in that function with a nice explination |
fixes jestjs#6141 Update the coverage reporting so that it still conforms to the documentation but doesn't throw an error when there are no files matching "global" threshold group (maybe because they are already matched with a path or glob). Also make sure that a file is matched against all matching path and glob threshold groups instead of just one.
fixes jestjs#6141 Update the coverage reporting so that it still conforms to the documentation but doesn't throw an error when there are no files matching "global" threshold group (maybe because they are already matched with a path or glob). Also make sure that a file is matched against all matching path and glob threshold groups instead of just one.
fixes jestjs#6141 Update the coverage reporting so that it still conforms to the documentation but doesn't throw an error when there are no files matching "global" threshold group (maybe because they are already matched with a path or glob). Also make sure that a file is matched against all matching path and glob threshold groups instead of just one.
fixes jestjs#6141 Update the coverage reporting so that it still conforms to the documentation but doesn't throw an error when there are no files matching "global" threshold group (maybe because they are already matched with a path or glob). Also make sure that a file is matched against all matching path and glob threshold groups instead of just one.
fixes jestjs#6141 Update the coverage reporting so that it still conforms to the documentation but doesn't throw an error when there are no files matching "global" threshold group (maybe because they are already matched with a path or glob). Also make sure that a file is matched against all matching path and glob threshold groups instead of just one.
fixes jestjs#6141 Update the coverage reporting so that it still conforms to the documentation but doesn't throw an error when there are no files matching "global" threshold group (maybe because they are already matched with a path or glob). Also make sure that a file is matched against all matching path and glob threshold groups instead of just one.
…6334) * Improve the message when running coverage while there are no tests fixes #6141 Update the coverage reporting so that it still conforms to the documentation but doesn't throw an error when there are no files matching "global" threshold group (maybe because they are already matched with a path or glob). Also make sure that a file is matched against all matching path and glob threshold groups instead of just one. * use Object.assign * Only mock specific functions exported by istanbul-lib-coverage (instead of the whole module). So that I can use the original createCoverageSummary function to create test data. * Add e2e tests for coverage threshold. I added snapshots for stderr so that I could test the Jest errors raised for each failed threshold group. * revert unnecessary test changes * linting * Replace process.cwd() in stderr snapshot test. * Make the tests more robust by using extractSummary method to compare stderr snapshots. Do a replace on the stderr which has a full path to a failed glob threshold file which won't match when the test runs on windows (appveyor) * move changelog entry
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. |
🐛 Bug Report
When you run
jest
with--coverage
but there are no tests, it shows error "Jest: Coverage data for global was not found."To Reproduce
Delete all test files e.g. *.test.js
Run
jest --config=jest.json --coverage
with below configuration injest.json
:Expected behavior
A simple and clear error like "No tests found", or simply skipping coverage, or coverage report as usual (and failed 100%).
Link to repl or repo (highly encouraged)
https://github.com/Tiendq/lego-part-loader
Run
npx envinfo --preset jest
System: OS: macOS Sierra 10.12.6 Binaries: Node: 10.0.0 - /usr/local/bin/node Yarn: 1.6.0 - /usr/local/bin/yarn npm: 5.6.0 - /usr/local/bin/npm npmPackages: jest: ^22.4.3 => 22.4.3
The text was updated successfully, but these errors were encountered: