Description
Version
24.3.0
Platform
Subsystem
No response
What steps will reproduce the bug?
- Create a node.config.json file and include
"experimental-test-coverage": true
- in CLI, run
node --experimental-config-file='./node.config.json' --test
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior? Why is that the expected behavior?
It behaves like passing the CLI flag --experimental-test-coverage
.
What do you see instead?
It appears the test coverage "flag" from the config file is getting passed along to the various sub-processes the test runner spawns, and they are each reporting their own set of tests' coverage. And then at the end, the parent process reports the full coverage.
Additional information
Merely moving the test coverage flag from config file to cli (leaving other options in the config file) avoids the issue.
node.config.test.json
{
"$schema": "https://nodejs.org/dist/v24.3.0/docs/node-config-schema.json",
"nodeOptions": {
"import": [
"../../test/snapshots.mts"
]
},
"testRunner": {
"experimental-test-coverage": true,
"experimental-test-module-mocks": true,
"test-coverage-exclude": [
"**/test/**",
"**/*.mock.ts",
"**/*.test.ts"
]
}
}