You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Observe that coverage is only reported for changed files (only alpha.js)
Press a
Expect a coverage report for all files.
Observe that coverage is still only reported for changed files.
This applies to all filters. Once you activate coverage reporting only for changed files, you can't switch back to coverage for all files without restarting jest.
Expected behavior
I have a few ideas about what could be expected, but I think it is quite hard to get this right.
A: Watch reports coverage for all files, unless it is testing only changed files.
If you specifically run a test regex the user is probably also interested in the coverage report for the unchanged files that were involved.
B: Watch reports only coverage for changed files.
This would make coverage reports useful when working on individual files.
C: Guess which files the user is interested in
Maybe figure out which files were involved in the executed tests and only print their coverage. We probably even can figure out which functions were involved and only report their coverage.
Actual behavior
Watch with coverage has no documentation afaik.
If you run jest --watch --coverage it only prints the coverage report for changed files, even if you interactivly specify a custom test regex.
If you run jest --watch --coverage -t something it prints the coverage report for all files.
Once jest starts printing the report only for changed files, there is no way back to printing it for all files.
Additional context
The behaviour of watching only changed files with coverage activated can be quite unexpected and confusing.
I think generating coverage reports without running all tests is a bad idea, because there will be files that only have some tests executed.
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.
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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.
Version
28.1.3
Steps to reproduce
echo " " >> alpha.js
)jest --watch --coverage --watchAll
o
alpha.js
)a
This applies to all filters. Once you activate coverage reporting only for changed files, you can't switch back to coverage for all files without restarting jest.
Expected behavior
I have a few ideas about what could be expected, but I think it is quite hard to get this right.
A: Watch reports coverage for all files, unless it is testing only changed files.
If you specifically run a test regex the user is probably also interested in the coverage report for the unchanged files that were involved.
B: Watch reports only coverage for changed files.
This would make coverage reports useful when working on individual files.
C: Guess which files the user is interested in
Maybe figure out which files were involved in the executed tests and only print their coverage. We probably even can figure out which functions were involved and only report their coverage.
Actual behavior
Watch with coverage has no documentation afaik.
If you run
jest --watch --coverage
it only prints the coverage report for changed files, even if you interactivly specify a custom test regex.If you run
jest --watch --coverage -t something
it prints the coverage report for all files.Once jest starts printing the report only for changed files, there is no way back to printing it for all files.
Additional context
The behaviour of watching only changed files with coverage activated can be quite unexpected and confusing.
I think generating coverage reports without running all tests is a bad idea, because there will be files that only have some tests executed.
Related issues
Environment
System: OS: Linux 5.18 NixOS 22.05 (Quokka) 22.05 (Quokka) CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11950H @ 2.60GHz Binaries: Node: 16.16.0 - /nix/store/vs43ydaw3k0pqa2z3s9mprqaymmbj66p-nodejs-16.16.0/bin/node Yarn: 1.22.18 - /nix/store/8fa68i731y9pda2jh52caqc26cqi6h2d-yarn-1.22.18/bin/yarn npm: 8.11.0 - /nix/store/vs43ydaw3k0pqa2z3s9mprqaymmbj66p-nodejs-16.16.0/bin/npm npmPackages: jest: ^28.1.3 => 28.1.3
The text was updated successfully, but these errors were encountered: