karma-coverage
karma-coverage copied to clipboard
coverage only generated for the last browser (when having multiple browsers)
Assuming you have the following configuration:
coverageReporter: {
dir: "build/coverage/",
reporters: [{
type: "html",
subdir: "report-html"
}, {
type: "lcov",
subdir: "report-lcov"
}, {
type: "text"
}]
}
and you are having multiple browsers configured. Then what you get is a folder build/coverage/report-html/
with e.g.
So you are only able to view the coverage for the last runned browser. However, when removing the subdir
property from the above snippet, a folder structure like the following will be generated under build/coverage/
, to view coverage for all browsers.
Unfortunately I can't live without using subdir
as this means that all reports will be written to the same directory.
@dignifiedquire is this a known behavior?
you can use a function as the value to subdir to fix this. The browser's name is passed in, so you can use it like this:
function(browserName) { return path.join('report-html', browserName) }
and for the report-lcov reporter:
function(browserName) { return path.join('report-lcov', browserName) }
And it will output stuff into this hirarchy:
report-html/Firefox 45.0.0
report-html/PhantomJS 2.1.1
report-lcov/Firefox 45.0.0
report-lcov/PhantomJS 2.1.1