【问题标题】:karma coverage does not show any data业力覆盖不显示任何数据
【发布时间】:2014-09-01 12:26:11
【问题描述】:

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

karma.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 文件正在测试中 -> 规范 -> conf 和源文件在 app -> js -> controllers/directives/services

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

【问题讨论】:

    标签: karma-runner karma-jasmine test-coverage


    【解决方案1】:

    使用以下流程:

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

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

    • 查看更新的报告

    【讨论】:

      猜你喜欢
      • 2015-10-06
      • 1970-01-01
      • 2016-03-21
      • 2015-12-27
      • 2016-01-30
      • 1970-01-01
      • 2012-12-07
      • 2022-07-27
      • 2021-10-19
      相关资源
      最近更新 更多