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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
'-o --coverage' should only show the coverage of changed files. #7539
Comments
I recall we fixed that in master, but can't find the commit. Can you check |
6a77ee3#diff-9523ac5aa456fb73fc8008d14432dfff |
I think the problem only appears when comparing against your own branch, even the remote branch you cloned. It works fine when comparing against a parent or sibling. |
Sounds like a bug, would you mind investigating and maybe send a PR with a fix? Or at least provide a repro :) |
Looks like a duplicate of #6859 |
Let's fix it there, as there's repro provided. Also @sai-chai please confirm it's OK to close this. |
Was this fixed? |
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. |
馃殌 Feature Proposal
Combining -o, --onlyChanged, or --watch with --coverage should first run the changed files only, then display coverage for the changed files only, and then rerunning automatically on a save or when Enter/Return is pressed.
Motivation
Jest CLI would work better if it allowed quick limited tests. You should be able to have it running the background as you're writing tests. "--watchAll --coverage" is convenient if you type 'o' or 'f' after the initial run. At that point coverage will only be shown for the files that were tested. However, if you're testing a large enough project, you will end up stuck in that initial run for a while. That's not convenient at all. --watch --coverage doesn't provide that same functionality. After the files are tested, coverage is calculated for the entire project.
Example
Before writing tests, I would start jest --watch --coverage. The program would inform me that there are no changed files. Then I'd write my first test and save it. Jest would automatically run it and show me the remaining coverage on the specific file I was testing only. This would make it easier to continuously test one specific file and see the remaining coverage without pouring over a massive table of values
Pitch
This feature already exists in the platform as part of the flow of --watchAll but it isn't consistent across similar CLI tools. --watch and -o should use --coverage as an alias of --collectCoverageFrom, just like --watchAll does. It's likely a very simple fix and would greatly help users of Jest.
The text was updated successfully, but these errors were encountered: