Generate coverage for uncovered source files #2892
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
The coverage tool of Jest did not generate the coverage for files that were not covered at all. E.g. files that are completely untested. The bad news: A lot of commands are left untested and the total coverage is significantly lower than before. The good news: after this change, you can actually see which commands require more tests which others might be able to contribute!
To trigger coverage for all files, the option
collectCoverageFrom
can be used per jestjs/jest#1211 (comment)Test plan
Run
yarn test
and opencoverage/lcov-report/index.html
in a browser of your preference. Observe that a lot of commands are now showing 0% coverage. The previous coverage report did not include these empty coverage files.