将业力配置为使用cobertura和trx之后,它不再等待构建完成才尝试开始测试。
因此,这淹没了我可以从构建过程中获得的任何错误消息,这意味着,如果我在.spec.ts文件之一中出现错误,则不会得到关于它在哪里的反馈,我只会得到chrome 60秒后超时
此处的更改来自于由角度cli生成的标准karma.conf.js
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'),
require('karma-trx-reporter')
],
client: {
clearContext: false // leave Jasmine Spec Runner output visible in browser
},
coverageReporter: {
type: 'cobertura'
},
remapIstanbulReporter: {
reports: {
cobertura: './coverage/cobertura-coverage.xml'
}
},
remapCoverageReporter: {
cobertura: './coverage/cobertura-coverage.xml'
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, './coverage'),
reports: ['html', 'lcovonly', 'text-summary', 'cobertura'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml', 'trx'],
trxReporter: {
outputFile: 'dist_test/test-results.trx',
shortTestName: false,
nameFormatter: (browser, result) => result.fullName
},
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false,
restartOnFileChange: true
});
};
运行“ ng test”时,我在输出中得到了这个
02 10 2019 18:11:04.309:INFO [karma-server]: Karma v4.0.1 server started at http://0.0.0.0:9876/
02 10 2019 18:11:04.309:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
02 10 2019 18:11:04.315:INFO [launcher]: Starting browser Chrome
最后一个信息是关于.scss文件的,但是在这种情况下,问题是spec.ts文件中的类名错误。