gpt4 book ai didi

未生成 Angular karma 代码覆盖率报告文件夹

转载 作者:行者123 更新时间:2023-12-04 11:55:52 25 4
gpt4 key购买 nike

当我跑 ng test --code-coverage , 覆盖率报告有时不生成,有时它正在生成所以我无法在做测试套件后验证覆盖率声明。
我的 karma 配置

// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html

module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};

最佳答案

就我而言,一切似乎都正确,但控制台上没有生成覆盖文件或消息。

解决问题的是编辑angular.json,添加以下键:

projects.ClientApp.test.options.codeCoverage = true;

关于未生成 Angular karma 代码覆盖率报告文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57322227/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com