istanbul
istanbul copied to clipboard
Zero line in coverage report
Hello,
first of all, thanks for great work. I am using karma-coverage, which has dependency on instanbul, for html report of test coverage of ES6 code in my application. It can be possible, if replace instanbul-instrumenter-loader for webpack with isparta.
But I got the problem - zero line in lcov file, like a: DA:0,1 DA:1,1 ...
because some lines in ES6 code referenced on non-existing lines in ES5 transpiled code and isparta for these lines returns something like: { start: { line: 0, column: 0 }, ..., skip: true }
.
I have to use this lcov file for generating reports with SonarQube, but it raise error, because it can't pass zero line, because line counter starts with 1.
I don't want to fork istanbul and karma-coverage, but I made some research and found in instanbul code the next lines in collector.js file:
fileCoverageFor: function (fileName) {
var ret = this.store.getObject(fileName);
utils.addDerivedInfoForFile(ret);
return ret;
},
if I replace this code with my own:
var ret = this.store.getObject(fileName);
var keys = Object
.keys(ret.statementMap)
.filter(function (key) {
return ret.statementMap[key].start.line === 0;
});
keys.forEach(function (key) {
delete ret.s[key];
delete ret.statementMap[key];
});
utils.addDerivedInfoForFile(ret);
return ret;
everything in lcov file will be correct. What do you think about this improvement and is it possible to add these lines or something else in istanbul for avoing my situation?
+1
The SonarQube team will provide a work around in the upcoming version (see ticket).
+1
Hi. Any update about this issue ? We r facing with the exact same problem.
+1
+1
+1
+1
+1
+1