如何设置 ng 测试代码覆盖目录?

Stu*_*ser 5 testing jasmine karma-runner tsconfig angular

我正在运行$ ng test -cc并很好地使用覆盖率报告。

但是,它出现在 src 文件夹中,这会导致 src 文件夹中 Find 的结果倾斜,该文件夹应该只是源文件夹,有没有办法可以指定生成coverage目录的所需位置,在tsconfig.spec.jsonkarma.conf.js也许?

yur*_*zui 8

karma-coverage-istanbul-reporter负责这些设置。

业力配置文件

const path = require('path');

module.exports = function (config) {
  config.set({
    ...
    coverageIstanbulReporter: {
       reports: ['html', 'lcovonly'],
       fixWebpackSourcePaths: true,
       dir: path.join(__dirname, 'coverage2') <== this option
    },
Run Code Online (Sandbox Code Playgroud)