-
-
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
Jest Coverage All Files #1211
Comments
I'm also looking for this functionality. Our code coverage reports would be much more useful if they reported on all the files we're targeting for coverage. |
we're working on it right now, so probably in a few weeks that should be implemented |
@calclavia my hacky way around this was to generate a jest test before running code coverage that requires every file that I'm interested in instrumenting. Not ideal but works for my CI for now.
|
See #1354. This will be in the next major release of Jest. Woohooo! |
yay! |
This is now part of the latest Jest pre-release and will be in Jest 15. @DmitriiAbramov rewrote Jest's code coverage support. Please try with The new option is |
The For e.g. given the following source files:
and tests:
If i set the jest@15.1.1 |
@jsynowiec do you have an example project that i can look at? and what does your full config look like? |
@DmitriiAbramov yes, you can check my jsynowiec/node-typescript-boilerplate. In my current project Jest configuration is the same. You can clone that repository and add a new file ( I'm getting following output
but I expected to also see
|
@jsynowiec i could reproduce the issue and was able to fix it by removing
from the config. @cpojer if we have |
|
@cpojer @DmitriiAbramov thanks for clarifying this. API documentation is currently a bit misleading.
|
hi @jsynowiec Were you able to find a fix ? My jest configuration is -
app has a folder main and lots of folder inside. And tests folder follow the same structure. `PASS tests/main/components/PrimaryNav.test.js ----------|----------|----------|----------|----------|----------------|
|
hey @umgupta
you should have
you can find globs documentation here https://github.com/sindresorhus/multimatch |
Thanks, that worked :) |
oh, I'm so lucky to find that solution today! |
When I use the How do I change this? |
I think that should work due to #5601? |
jest coverage report ignores untested files by default, which results in incorrect coverage summary when some files lack tests. see also: https://jestjs.io/docs/en/configuration#collectcoveragefrom-array jestjs/jest#1211
In case anyone still having issues. I am working in Vue and was also getting empty code coverage reports. I changed the pattern to find the files and it works now. Here is my setup.
|
jest coverage report ignores untested files by default, which results in incorrect coverage summary when some files lack tests. see also: https://jestjs.io/docs/en/configuration#collectcoveragefrom-array jestjs/jest#1211
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. |
When Jest performs code coverage, it seems to only cover the files that were tested instead of all files in my source directory. This gives a skewed percentage of files tested.
For example, if I have 10 source files and I only test one of them, the coverage report will not include all the files. It would be nice if there's a way to specify which files should be covered. collectCoverageOnlyFrom does not seem to serve this purpose.
The text was updated successfully, but these errors were encountered: