gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 787 forks source link

incorrect cobertura report for es6 codes run by babel-node #734

Open Charles1000Chen opened 7 years ago

Charles1000Chen commented 7 years ago

babel-node ./node_modules/istanbul/lib/cli.js cover tests/jasmine-runner.js report cobertura

See from both console output and lcov report, the coverage summaries are 100%.

Statements : 100% ( 107/107 ) Branches : 100% ( 27/27 ) Functions : 100% ( 37/37 ) Lines : 100% ( 105/105 )

But look from the cobertura report, it shows as below:

Packages ------- Files ------------ Classes -------- Methods ------------- Lines -------- Conditionals 100% (7/7) -- 100% (15/15) -- 100% (15/15) -- 52% ()94/181 ----- 67% (392/588) ----- 100% (0/0)

Many babel compiled code like anonymous_x methods are counted in unexpectedly.

void (anonymous_0)()
0%
0/1 N/A void (anonymous_1)()
0%
0/1 N/A void (anonymous_13)() 0%
0/1 N/A void (anonymous_17)() 0%
0/1 N/A void (anonymous_18)() 0%
0/1 N/A void (anonymous_19)() 0%
0/1 N/A void _assign()
0%
0/1 N/A void _reset__()
0%
0/1 N/A void _set
() 0%
0/1 N/A void _set_original()
0%
0/1 N/A void _update_operation
()
0%
0/1 N/A void _with__()
0%
0/1 N/A void reset()
0%
0/1 N/A

"istanbul": "^1.0.0-alpha.2", "babel-cli": "6.4.5", "babel-core": "6.4.5", "babel-preset-es2015": "6.18.0",