-
-
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
[Feature]: Isolated coverage reports #13876
Comments
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Still not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Still not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
Hi, i made tool which allows to define coverage threshold per file tree https://github.com/andriyor/ts-tree-cli |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
Not stale |
🚀 Feature Proposal
An easy way to run Jest but generate coverage separately for each test file.
Motivation
A common pattern is to have a test file for each source file. But coverage is generated for the whole repo so one test can "accidentally" cover lines in another file. This leads to a problem where when for tests that need to be written based on code coverage, it shows that a branch is tested, but it may have been executed as a result of a different test suite that doesn't actually assert on the branch in question.
Example
Two parts:
collectCoverageFrom
as a function which is passed the current test file as an argument so you can dynamically set which source files coverage can be collected from given the test that is running.Pitch
There's not an easy or efficient way to do this without it being built-in.
Currently the best/only way to do it is with a custom script that finds all test files, finds the associated source files for each test file (in our case that is based on the file name) and then run jest to test only a single test file and gather coverage from only the one source file. Then run Jest hundreds of times, one for each test file to generate coverage separately for each.
I don't believe this is a change to the default reporter rather a different way of triggering the reporter. The way that the reporters work would stay the same, it'd just be executed anew for each test file.
The text was updated successfully, but these errors were encountered: