2

我的业力覆盖率显示语句、函数和行覆盖率的正确值,但分支覆盖率始终显示 0/0。我有将近 23 个规范文件,而且它们都一样。附上报告截图。

这是我的业力配置文件。

module.exports = config => config.set(
    client: {
        package,
        specs: package + '/test/specs'
    },
    singleRun: false,
    frameworks: ['jasmine'],
    browsers: ['PhantomJS'/*, 'Firefox', 'Chrome'*/],
    reporters: ['progress', 'junit', 'kjhtml', 'coverage'],
    files: [
        __dirname + '/../sinon.js',
        'packages/requirejs/require.js',
        __dirname + '/../testLoader.js',
        {pattern: 'test/**/*', included: false},
        {pattern: 'packages/**/*.js', included: false},
        {pattern: 'build/dist/**/*.js', included: false}
    ],
    proxies: {
        ['/base/packages/' + package + '/test/']: '/base/test/',
        ['/base/packages/' + package + '/']:      '/base/build/dist/'
    },
    middleware: ['config'],
    plugins: [
        'karma-*',
        {
            'middleware:config': ['value', (req, res, next)=>req.url.endsWith('config.json') ? res.end('{}') : next()]
        }
    ],
    junitReporter: {
        outputDir: 'build/reports/junit/',
        useBrowserName: false,
        outputFile: 'test-results.xml'
    },
    preprocessors: {
      // source files, that you wanna generate coverage for
      // do not include tests or libraries
      // (these files will be instrumented by Istanbul)
      'test/spec/*.js': ['coverage']
    },
    // optionally, configure the reporter
    coverageReporter: {
      type : 'html',
      dir : 'coverage/'
    }

);

业力覆盖报告

4

0 回答 0