nyc
nyc copied to clipboard
Coverage configuration in .nycrc overrides package.json config.
We have a default configuration specified in our .nycrc with the following:
{
"extends": "@istanbuljs/nyc-config-typescript",
"reporter": ["text", "html", "lcov"],
"check-coverage": true,
"lines": 0,
"statements": 0,
"functions": 0,
"branches": 0
}
In each package, we override with package-specific settings via the nyc
package.json stanza:
"nyc": {
"check-coverage": true,
"branches": 100,
"functions": 100,
"lines": 100,
"statements": 100
},
With nyc 14.1.1
this worked fine, but after upgrading to nyc 15.1.0
this seems to be broken/switched. i.e. the .nycrc coverage config now takes precedence.
Link to bug demonstration repository
Expected Behavior
Coverage specs in the package.json "nyc"
stanza should override coverage specs in the .nycrc
file.
Observed Behavior
The coverage specs in the .nycrc
file are taking precedence over the package.json config.
Troubleshooting steps
- [ ] Base config in .nycrc is set to 0 for all coverages, package.json is set to 100 for all. Tests pass even though branch coverage is below 100.
- [ ] Updated
lines
,statements
,functions
, andbranches
config to100
in .nycrc and tests started failing. - [ ] Removed
lines
,statements
,functions
, andbranches
config from .nycrc and tests started failing due to package.json specs.
Environment Information
System:
OS: macOS 11.3
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 1.67 GB / 32.00 GB
Binaries:
Node: 12.22.1 - ~/.nvm/versions/node/v12.22.1/bin/node
Yarn: 1.22.0 - ~/.nvm/versions/node/v12.22.1/bin/yarn
npm: 6.14.12 - ~/.nvm/versions/node/v12.22.1/bin/npm
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
@MattRoss34 Did you find a solution to this? Experiencing exactly the same issue here right now.