Iladarsda Iladarsda - 1 year ago 165
Node.js Question

Karma - Istanbul - code coverage report path

I am using

as a jasmine test runner, with
as a code coverage tool.
All works perfectly, one question though - is there any way I could change the path to the report that is created?

i.e. for Chrome I get
; I would much more happy with

Any suggestions much appreciated.

Answer Source

Add this to your karma.conf.js:

    coverageReporter: {
        dir: 'coverage/',
        subdir: 'Chrome',
        file: 'index.html'

EDIT: To have a subdir name based on the name of the browser used for the test:

    coverageReporter: {
        dir: 'coverage',
        subdir: function(browser) {
            return browser.toLowerCase().split(/[ /-]/)[0];
        file: 'index.html'