在chrome中运行单元测试时,我无法获得karma jasmine Html报告 . Chrome正在加载组件的html但未显示测试结果 .

但是我在终端本身得到了测试结果 . 我已尝试在karma.config.js中添加以下内容,但会收到错误 .

在Pulgins - > require('karma-jasmine-html-reporter')记者 - > kjhtml

{

"message": "Uncaught TypeError: env.stopOnSpecFailure is not a function\nat node_modules/karma-jasmine-html-reporter/src/lib/adapter.js:26:7\n\nTypeError: env.stopOnSpecFailure is not a function\n    at node_modules/karma-jasmine-html-reporter/src/lib/adapter.js:26:7\n    at node_modules/karma-jasmine-html-reporter/src/lib/adapter.js:76:3",

"str": "Uncaught TypeError: env.stopOnSpecFailure is not a function\nat node_modules/karma-jasmine-html-reporter/src/lib/adapter.js:26:7\n\nTypeError: env.stopOnSpecFailure is not a function\n    at node_modules/karma-jasmine-html-reporter/src/lib/adapter.js:26:7\n    at node_modules/karma-jasmine-html-reporter/src/lib/adapter.js:76:3"

}

以下是package.json中的版本

"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "^4.1.0",
"karma": "~2.0.0",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "^1.1.0",
"karma-jasmine-html-reporter": "^1.1.0",

下面是Karma.config.js

// Karma配置文件,有关详细信息,请参阅链接// https://karma-runner.github.io/1.0/config/configuration-file.html

process.env.CHROME_BIN = require('puppeteer').executablePath();

module.exports = function(config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular/cli'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-junit-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular/cli/plugins/karma'),
      require('karma-jasmine-html-reporter')
    ],
    client: {
      clearContext: false, // leave Jasmine Spec Runner output visible in browser
      captureConsole: false
    },
    junitReporter: {
      outputDir: 'reports/junit/',
      outputFile: 'TESTS-xunit.xml',
      useBrowserName: false,
      suite: '' // Will become the package name attribute in xml testsuite element
    },
    coverageIstanbulReporter: {
      reports: ['html', 'lcovonly', 'text-summary'],
      dir: './reports/coverage',
      fixWebpackSourcePaths: true
    },
    angularCli: {
      environment: 'dev'
    },
    reporters: ['progress', 'junit', 'kjhtml'],
    port: 9876,
    colors: true,
    // Level of logging, can be: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    singleRun: false
  });
};