我的覆盖率始终显示为 0/0 和 100%。我发现了一些指向错误报告和文档的链接,但没有任何帮助。
这是我的配置文件
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '../../..',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
// list of files / patterns to load in the browser
files: [
"./CloudConnect.PE.TheApp/Static/CloudConnect.Web.Shared/js/common.js",
"./CloudConnect.PE.Test/node_modules/angular-mocks/angular-mocks.js",
"./CloudConnect.PE.TheApp/Static/CloudConnect.Web.Shared/js/bridge/browser.min.js",
{ pattern: "./CloudConnect.PE.TheApp/Static/CloudConnect.Web.Shared/js/bridge/**/*.js", watched: false, included: false },
{ pattern: "./CloudConnect.PE.TheApp/Static/CloudConnect.Web.Shared/css/**/*.css", watched: false, included: true, served: true },
{ pattern: "./CloudConnect.PE.TheApp/Static/CloudConnect.Web.Shared/images/*.*", watched: false, included: false, served: true },
"./CloudConnect.PE/static/cloudconnect.pe/js/shared.js",
"./CloudConnect.PE.Test/Client/ActWeb/tests/init.spec.js", // always load init.spec.js
"./CloudConnect.PE.ActWeb/static/CloudConnect.PE.ActWeb/js/app.js",
"./CloudConnect.PE.Test/Client/ActWeb/tests/**/*.spec.js"
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
"./CloudConnect.PE.ActWeb/static/cloudconnect.pe.actweb/js/app.js": ["coverage"]
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage'],
coverageReporter: {
type: 'html',
dir: './CloudConnect.PE.Test/Client/coverage/ActWeb'
}
});
};
我不得不删除一些配置,所以 SO 会让我发帖。显然我必须在我的帖子中使用完整的配置编写很多代码。