Open lo1tuma opened 8 years ago
Could you try the new version I just pushed. check-coverage
was erroneously computing coverage from the raw
(pre-source map) files as opposed to the post processed files.
Reopen if the problem still exists.
Hi @gotwarlost, I’ve tried istanbul-api version 1.0.0-alpha.10, but the problem still exists:
$ npm ls | grep istanbul
├─┬ istanbul@1.0.0-alpha.2
├─┬ istanbul-api@1.0.0-alpha.10
│ ├── istanbul-lib-coverage@1.0.0-alpha.4
│ ├─┬ istanbul-lib-hook@1.0.0-alpha.4
│ ├─┬ istanbul-lib-instrument@1.0.0-alpha.6
│ ├─┬ istanbul-lib-report@1.0.0-alpha.3
│ ├── istanbul-lib-source-maps@1.0.0-alpha.9
│ ├── istanbul-reports@1.0.0-alpha.4
Coverage summary:
=============================== Coverage summary ===============================
Statements : 100% ( 207/207 )
Branches : 100% ( 50/50 )
Functions : 100% ( 81/81 )
Lines : 100% ( 207/207 )
================================================================================
check-coverage output:
> istanbul check-coverage --statement 100 --branch 100 --function 100 --lines 100
/Users/foo/workspace/myproject/node_modules/istanbul/lib/cli.js:38
throw ex; // turn it into an uncaught exception
^
ERROR: Coverage for statements (98.04%) does not meet global threshold (100%)
ERROR: Coverage for branches (85.85%) does not meet global threshold (100%)
Dammit, will take a look. Thanks for testing. If this project is public on github, could you give me a link. Otherwise, I'll deal with reproducing it.
Unfortunately the project is not opensource, but I’ve create a reproducible example based on sample-mocha-compilers
.
FWIW this change solved the issue for me, but I'm not sure if this is the correct way to solve the problem.
Thanks for the repro case. I will look into in shortly.
+1 Having the same problem.
+1 Any updates yet? Love istanbul, want to go on using it.
+1 Same problem related issue https://github.com/gotwarlost/istanbul/issues/631
The difference between cover
and check-coverage
seems to be something around using source maps or not.
cover
https://github.com/istanbuljs/istanbul-api/blob/master/lib/run-cover.js#L167
check-coverage
https://github.com/istanbuljs/istanbul-api/blob/master/lib/run-check-coverage.js#L83
Not sure how to fix this though, any help?
+1 Still a problem on 1.1.0-alpha.1 .Any updates yet? Thanks
Awesome. All works nicely now using nyc. Thanks
I’m using istanbul
1.0.0-alpha2
with a setup similar tosample-babel-node
. Mynpm test
script looks like this:If I run this script I get different results for the
cover
andcheck-coverage
command:cover command:
check-coverage command:
As you can see the coverage for e.g. branches is one time 99.89% and the other time it is only 63.77%. I think the problem is that the
check-coverage
command reads the coverage result fromcoverage.raw.json
which is the coverageMap before the source map was applied. I’ve changed this code on my local istanbul installation to write the content oftransformed.map
instead offinalCoverage
to thecoverage.raw.json
file. This solved the problem for me.