0

我已将源文件包含在我的 karma conf 文件的文件和预处理器部分中。测试运行良好,junit xml 报告显示数据。html 覆盖率仅显示 100%,没有任何数据。对于另一个运行良好但不是这个的项目,我有类似的结构。不确定我是否遗漏了什么。可能是我错过的一件非常次要或愚蠢的事情。

业力.conf.js:

module.exports = function (config) {
config.set({
basePath: '../../',

frameworks: [
    'jasmine'
],

// list of files / patterns to load in the browser
files: [
    'app/js/**/*.js',
    'test/spec/**/*.js'
],

preprocessors: {
    'app/js/**/*.js': ['coverage']
},

exclude: [],

reporters: [ 'progress', 'junit', 'coverage' ],

coverageReporter: {
    type: 'html',
    dir: 'test/reports/unit/coverage'
},

junitReporter: {
    outputFile: 'test/reports/unit/junit/junit.xml',
    suite: 'unit'
},

port: 9876,

runnerPort: 9100,

colors: true,

logLevel: config.LOG_DEBUG,

autoWatch: false,

browsers: [ 'Chrome' ],

captureTimeout: 60000,

singleRun: true
});
};

我的 karma conf 文件在 test -> spec -> conf 和源文件在 app -> js -> controllers/directives/services

调试日志显示其加载预处理器中的所有文件,但报告未显示任何数据“无数据显示”。

4

1 回答 1

0

使用以下过程:

  • 将基本路径附加到预处理器路径:

    ../../app/js/**/*.js': ['coverage']
    
  • 重启业力

  • 查看更新的报告

于 2015-07-16T19:30:38.673 回答