🚀 Feature Proposal
coverage shows for full run but for specific files nothing or mixed
I want to be able to run with:
o option from jest menu
jest --watch --coverage STRING_FOR_REGEX_TESTS_SELECTION
jest --watch --coverage --runTestsByPath SPECIFIC_FILE_PATH
And have the coverage for the files impacted only.
Motivation
it's all about productivity.
1. Tech Debt of tests
When we work on tech debt of tests => it's generally one by one (file by file).
So I mostly run targeting the file i am working on. The run in watch mode is faster this way. I would like to see the coverage related to the current file i am targeting (should be faster to generate?)
2. Same thing apply for development of new features
Devs don't do TDD most of the time and do the test after. Testing files one by one is faster especially if you split between multiple developers the work.
this is a reality happening in a lot of companies.
Example
Jest version: "23.6.0"
jest config:
module.exports = {
preset: 'jest-preset-angular',
setupTestFrameworkScriptFile: '<rootDir>/src/setupJest.ts',
roots: ['src/app'],
moduleFileExtensions: ['ts', 'js']
};
in this repo branch:
(sorry i didn't clean i just commited the state since i am playing with jest to help in vscode-jest repo)
https://github.com/nasreddineskandrani/full-example-angular/tree/jest-playaround
- clone the repo
yarn install
-- Example 1 Steps
yarn run testjest:watch -- --coverage
- run all tests (the coverage is fine) and the coverage result is:

- now use
w then o (Press o to only run tests related to changed files.)
then you change the file src\app\game\game-a.service.spec.ts the condition true to false and vise versa
Resulting coverage (PROBLEM):

-- Example 2 Steps
when i run:
yarn run testjest:watch -- --coverage game-a.service.spec.ts
I get:

WHY HERO.SERVICE impacted here? setupJest.ts ....?
-- Example 3 Steps
when i run:
yarn run testjest:watch --coverage --runTestsByPath src/app/game/game-a.service.spec.ts
I get:

WHY HERO.SERVICE impacted here? setupJest.ts ....?
Result expected:
- I want to be able to see only the coverage of the file i changed
- I want to be able to see only the coverage of the file(s) i watch (with regex or path)
=> without doing any custom config since the file(s) impacted are known.
🚀 Feature Proposal
coverage shows for full run but for specific files nothing or mixed
I want to be able to run with:
ooption from jest menujest --watch --coverage STRING_FOR_REGEX_TESTS_SELECTIONjest --watch --coverage --runTestsByPath SPECIFIC_FILE_PATHAnd have the coverage for the files impacted only.
Motivation
it's all about productivity.
1. Tech Debt of tests
When we work on tech debt of tests => it's generally one by one (file by file).
So I mostly run targeting the file i am working on. The run in watch mode is faster this way. I would like to see the coverage related to the current file i am targeting (should be faster to generate?)
2. Same thing apply for development of new features
Devs don't do TDD most of the time and do the test after. Testing files one by one is faster especially if you split between multiple developers the work.
this is a reality happening in a lot of companies.
Example
Jest version: "23.6.0"jest config:
in this repo branch:
(sorry i didn't clean i just commited the state since i am playing with jest to help in vscode-jest repo)
https://github.com/nasreddineskandrani/full-example-angular/tree/jest-playaround
yarn install-- Example 1 Steps
yarn run testjest:watch -- --coveragewtheno(Press o to only run tests related to changed files.)then you change the file
src\app\game\game-a.service.spec.tsthe conditiontruetofalseand vise versaResulting coverage (PROBLEM):
-- Example 2 Steps
when i run:

yarn run testjest:watch -- --coverage game-a.service.spec.tsI get:
WHY HERO.SERVICE impacted here? setupJest.ts ....?
-- Example 3 Steps
when i run:

yarn run testjest:watch --coverage --runTestsByPath src/app/game/game-a.service.spec.tsI get:
WHY HERO.SERVICE impacted here? setupJest.ts ....?
Result expected:
=> without doing any custom config since the file(s) impacted are known.