Open vellala2000 opened 3 years ago
I am seeing a similar or identical issue. It occurs when including the typescript config preset, and removing that from my package.json
seems to fix the coverage.
With the nyc
config stanza like so:
"nyc": {
"cache": false,
"branches": 10,
"lines": 10,
"functions": 10,
"statements": 10
}
I see the expected coverage:
Statements : 43.18% ( 620/1436 )
Branches : 40.98% ( 159/388 )
Functions : 45.61% ( 161/353 )
Lines : 42.99% ( 595/1384 )
Adding the preset, with or without the additional cache
key, immediately brings coverage down by about (but not exactly) half:
Statements : 20.3% ( 288/1419 )
Branches : 9.52% ( 36/378 )
Functions : 22.7% ( 79/348 )
Lines : 19.39% ( 265/1367 )
With the following in package.json
:
"nyc": {
"extends": "@istanbuljs/nyc-config-typescript",
"branches": 10,
"lines": 10,
"functions": 10,
"statements": 10
}
As far as I can tell, the preset only defines cache
and parserPlugins
(https://github.com/istanbuljs/istanbuljs/blob/master/packages/nyc-config-typescript/index.js), and changing cache
in my package.json
does not seem to make a difference. I have tried running with an existing out/
dir and cleaning beforehand, same results. I don't have a MVCE, but building https://github.com/ssube/textual-engine with make cover
in a codespace/gitpod should demonstrate the issue.
Link to bug demonstration repository
https://github.com/vellala2000/nyc-bug-demo
Expected Behavior
Some level of coverage for logger.js file with 'npm run jscoverage'
Observed Behavior
0% coverage for logger.js file.
Troubleshooting steps
cache: false
in my nyc configEnvironment Information