我正在使用 Karma 来运行我的单元测试,现在正尝试将其整合karma-coverage
到我的流程中。我正在PhantomJS
使用singleRun: true
. 每当我这样做时,我的代码覆盖率报告器似乎都没有运行。如果我设置singleRun: false
,则创建文件夹和文件。
为什么业力覆盖工具没有运行?
这是我的配置文件:
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['mocha', 'requirejs', 'sinon-chai'],
files: [
{ pattern: 'bower_components/angular/angular.js', included: false },
{ pattern: 'bower_components/jquery/dist/jquery.js', included: false },
{ pattern: 'bower_components/angular-mocks/angular-mocks.js', included: false },
{ pattern: '**/*.js', included: false },
{ pattern: 'KarmaTests/test-main.js', included: true },
{ pattern: 'KarmaTests/**/*Test*.js', included: false }
],
preprocessors: {
'KarmaTests/*/*.js': ['coverage']
},
reporters: ['progress', 'coverage'],
coverageReporter: {
type: 'html',
dir: '_testCoverage/',
file: 'cover.html'
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['PhantomJS'],
//files are created when false, are not when true
singleRun: false
});
};