Karma Start Chrome失败了2次

时间:2017-10-20 19:42:23

标签: angular unit-testing karma-runner karma-jasmine

当我运行Karma Start运行Angular 4应用程序的单元测试时,我收到此错误:

Chrome have not captures in 60000 ms, killing

Trying to start Chrome again (1/2).

Chrome have not captures in 60000 ms, killing

Trying to start Chrome again (2/2).

Chrome failed 2 times (timeout). Giving up.

这是我的karma.conf.js文件

// Karma configuration file, see link for more information
// https://karma-runner.github.io/0.13/config/configuration-file.html

module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular/cli'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular/cli/plugins/karma')
    ],
    client:{
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    files: [
      { pattern: './src/test.ts', watched: false }
    ],
    preprocessors: {
      './src/test.ts': ['@angular/cli']
    },
    mime: {
      'text/x-typescript': ['ts','tsx']
    },
    coverageIstanbulReporter: {
      reports: [ 'html', 'lcovonly' ],
      fixWebpackSourcePaths: true
    },
    angularCli: {
      environment: 'dev'
    },
    reporters: config.angularCli && config.angularCli.codeCoverage
              ? ['progress', 'coverage-istanbul']
              : ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['ChromeNoSandbox'],
    customLaunchers: {
      ChromeNoSandbox: {
        base: 'Chrome',
        flags: ['--no-sandbox']
      }
    },
    singleRun: false,
    browserNoActivityTimeout: 60000
  });
};

经过研究后,似乎可能与使用的Chrome版本存在兼容性问题。我已经尝试将--no-sandbox标志添加到karma配置文件中,但它仍然无法正常工作。有人在那里有同样的问题或之前有过这个问题吗?不确定我的下一步应该是什么。

我运行Karma start后,会打开一个新的Chrome浏览器窗口,但它仍保留在空白屏幕上。

0 个答案:

没有答案