Merge istanbul test coverage from karma-coverage with coverage from other sources

1.7k Views Asked by At

I have several tests generating coverage reports with istanbul. One of them is generated by karma-coverage plugin. I am merging these reports with istanbul report but files from karma-coverage report are not included in the merged report.

There was an issue with file paths that had the same symptoms but it seems to have been fixed: https://github.com/karma-runner/karma-coverage/pull/163

So it is probably something else.

I have tried using grunt-istanbul that instruments source files separately and then I browserify them in the bundle. I also tried using preprocessor from karma-coverage plugin to instrument the bundle. In both cases karma-coverage generates reports that look ok, but in both cases these reports are not included in the merged report.

What am I doing wrongly here? Is there some workaround maybe?

Package versions:

"karma": "^0.13.10",
"karma-coverage": "^0.5.2",
"grunt-istanbul": "^0.6.1"

karma.conf.js

reporters: ['coverage', 'spec'],
coverageReporter: {
  type: 'lcov',
  dir: 'coverage'
}
2

There are 2 best solutions below

1
On

If you are able to generate coverage separately then you can merge them as specified here: link

0
On

Coverage reporter should have type: 'lcov' - then you can merge reports