Search code examples
javascriptkarma-runnerkarma-coverage

Karma report browser subfolders


I am using karma to run my javascript tests, and to generate a coverage report. Here is my coverage configuration from the karma.conf.js:

coverageReporter: {
      dir : 'coverage/',
      reporters: [
        { type: 'text-summary' },
        { type: 'html' },
        { type: 'lcov' }
      ]
}

What I do not like about the set-up is that I always get a subfolder named after the browser used to run the tests. In my case, I use only PhantomJS, and would prefer to have the reports directly under /coverage. Is there a way to do this?


Solution

  • Seems subdir is determined from dir, not from dir/. So this works fine:

    coverageReporter: {
          dir : 'coverage/',
          reporters: [
            { type: 'text-summary' },
            { type: 'html', subdir: '.' },
            { type: 'lcov', subdir: '.' }
          ]
        }