我的项目(Angular 11)有大约 350 个单元测试,在本地运行正常。 在 Azure CI 中,我最近经常收到以下错误:
在超时10000ms之前断开连接(0次)重连失败 (ping 超时)
我在 CI 中运行测试:
ng test --no-watch --code-coverage --browsers=ChromeHeadless
我的 Karma.config.js :
// Karma configuration file, see link for more information
// https://karma-runner.github.io/1.0/config/configuration-file.html
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular-devkit/build-angular'],
plugins: [
require('karma-jasmine'),
require('karma-coverage'),
require('karma-spec-reporter'),
require('karma-chrome-launcher'),
require('karma-jasmine-html-reporter'),
require('karma-junit-reporter'),
require('@angular-devkit/build-angular/plugins/karma')
],
client: {
clearContext: false
},
coverageReporter: {
dir: '../coverage',
subdir: '.',
reporters:[
{type: 'cobertura', file : 'cobertura-coverage.xml'},
{type: 'lcovonly'},
{type: 'text-summary'}
],
type : 'cobertura',
},
junitReporter: {
outputDir: require('path').join(__dirname, '..'),
},
reporters: ['progress', 'kjhtml', 'junit', 'spec', 'coverage'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
browserDisconnectTimeout: 10000
});
};
我想知道我的 Karma 配置是否有问题?有什么想法吗?