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
When collectCoverageFrom is set, then in watch mode with filtering by filename or test name
turned on the filename/test name filtering isn't taken into account for coverage calculation.
The easiest solution seems to be that when in watch mode test filtering is turned on, then collectCoverageFrom should be ignored.
Thanks to that coverage could be calculated for all required files when running all tests, and when filtering the test it would be obvious that coverage is calculated only for these tests and what they import. Coverage info in watch mode with tests filter is useful, as when working on some tests it can be easily seen if we have certain coverage for the code we work on or not.
To Reproduce
jest --watch --coverage --collectCoverageFrom='src/**/*.js'
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.
🐛 Bug Report
When
collectCoverageFrom
is set, then in watch mode with filtering by filename or test nameturned on the filename/test name filtering isn't taken into account for coverage calculation.
The easiest solution seems to be that when in watch mode test filtering is turned on, then
collectCoverageFrom
should be ignored.Thanks to that coverage could be calculated for all required files when running all tests, and when filtering the test it would be obvious that coverage is calculated only for these tests and what they import. Coverage info in watch mode with tests filter is useful, as when working on some tests it can be easily seen if we have certain coverage for the code we work on or not.
To Reproduce
jest --watch --coverage --collectCoverageFrom='src/**/*.js'
Detailed steps:
yarn
(or use npm)yarn test:watch:withCoverageFrom
p
in the menuadd-test
as a patterncollectCoverageFrom
and filter pattern isn't taken into accountExpected behavior
In watch mode with
collectCoverageFrom
set the filename/test name filtering is taken into account for coverage calculation.Link to repl or repo (highly encouraged)
https://github.com/duszans/jest-watch-collectCoverageFrom-filtering-repro
Run
npx envinfo --preset jest
Paste the results here:
Screenshoots
With collectCoverageFrom
Without collectCoverageFrom
The text was updated successfully, but these errors were encountered: