测试运行失败:断开连接(0次),因为在30000毫秒内没有消息]]

问题描述 投票:1回答:1

我正在开发一个有角度的应用程序,当我运行“ ng test”命令时,它显示了一些错误,并说“已断开连接(0次),因为30000毫秒内没有消息。'。我尝试更新业力,茉莉花软件包,并做了“ npm install”,但仍然无济于事。这是依赖项软件包和karma.conf.js文件。我在这里想念什么吗?是否需要任何软件包升级?

"devDependencies": {
    "@angular-devkit/build-angular": "~0.13.0",
    "@angular/animations": "^5.0.0",
    "@angular/cli": "~7.3.2",
    "@angular/compiler-cli": "~7.2.0",
    "@angular/language-service": "~7.2.0",
    "@types/jasmine": "~2.8.8",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.4.2",
    "husky": "^0.13.4",
    "jasmine-core": "^2.5.2",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^3.1.4",
    "karma-chrome-launcher": "^2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "^1.1.2",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.11.0",
    "typescript": "~3.2.2",
    "typescript-formatter": "^7.2.2",
    "webpack": "^4.9.2"
  },



module.exports = function (config) {
  config.set({
    basePath: '',
    frameworks: ['jasmine', '@angular-devkit/build-angular'],
    plugins: [
      require('karma-jasmine'),
      require('karma-chrome-launcher'),
      require('karma-jasmine-html-reporter'),
      require('karma-coverage-istanbul-reporter'),
      require('@angular-devkit/build-angular/plugins/karma')
    ],
    client: {
      clearContext: false // leave Jasmine Spec Runner output visible in browser
    },
    files: [
      {
        pattern: 'specs.ts',
        included: false
        }
    ],
    preprocessors: {

    },
    mime: {
      'text/x-typescript': ['ts', 'tsx']
    },
    coverageIstanbulReporter: {
      dir: require('path').join(__dirname, 'coverage'), reports: ['html', 'lcovonly'],
      reports: ['html', 'lcovonly', 'text-summary'],
      fixWebpackSourcePaths: true,
      thresholds: {
        statements: 80,
        lines: 80,
        branches: 80,
        functions: 80
      }
    },
    reporters: config.angularCli && config.angularCli.codeCoverage
      ? ['progress', 'coverage-istanbul']
      : ['progress', 'kjhtml'],
    port: 9876,
    colors: true,
    logLevel: config.LOG_INFO,
    autoWatch: true,
    browsers: ['Chrome'],
    customLaunchers: {
      ChromeHeadlessCI: {
        base: 'ChromeHeadless',
        flags: ['--no-sandbox']
      }
    },
    singleRun: false,
    restartOnFileChange: true
  });
};

我正在开发一个有角度的应用程序,当我运行“ ng test”命令时,它显示了一些错误,并说“已断开连接(0次),因为30000毫秒内没有消息。 '。我尝试更新业力,茉莉花包装...

angular karma-jasmine karma-runner angular-cli-v6
1个回答
0
投票

以下在karma.conf.js中的配置选项可能会有所帮助:

© www.soinside.com 2019 - 2024. All rights reserved.