Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the ng test code-coverage directory?

I'm running $ ng test -cc and using the coverage report nicely.

However, it appears in the src folder, which is skewing the results of Find in the src folder, which should just be the source folder, is there a way I can specify the desired location of the generated coverage directory, in tsconfig.spec.json or karma.conf.js perhaps?

like image 456
StuperUser Avatar asked Mar 26 '18 11:03

StuperUser


1 Answers

karma-coverage-istanbul-reporter is responsible for those settings.

karma.conf.js

const path = require('path');

module.exports = function (config) {
  config.set({
    ...
    coverageIstanbulReporter: {
       reports: ['html', 'lcovonly'],
       fixWebpackSourcePaths: true,
       dir: path.join(__dirname, 'coverage2') <== this option
    },
like image 119
yurzui Avatar answered Sep 20 '22 22:09

yurzui