在某些构建Angular应用程序的计算机上,该过程花费的时间超过2 * 60秒(由Karma启动的Chrome捕获内容的默认超时时间)。
是否有一种方法可以强制Karma在构建完成后启动Chrome?
我的package.json
:
{
"dependencies": {
"@angular/animations": "4.4.4",
"@angular/common": "4.4.4",
"@angular/compiler": "4.4.4",
"@angular/core": "4.4.4",
"@angular/forms": "4.4.4",
"@angular/http": "4.4.4",
"@angular/platform-browser": "4.4.4",
"@angular/platform-browser-dynamic": "4.4.4",
"@angular/platform-server": "4.4.4",
"@angular/router": "4.4.4",
"rxjs": "5.4.3",
"ts-md5": "^1.2.2",
"zone.js": "^0.8.17"
},
"devDependencies": {
"@angular/cli": "1.4.4",
"@angular/compiler-cli": "4.4.4",
"@types/jasmine": "2.5.45",
"@types/node": "~6.0.60",
"jasmine-core": "^2.8.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^1.7.1",
"karma-chrome-launcher": "^2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.3.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "^5.1.2",
"protractor-console-plugin": "^0.1.1",
"protractor-jasmine2-screenshot-reporter": "^0.4.1",
"ts-helpers": "1.1.2",
"ts-node": "^3.3.0",
"tslint": "^5.7.0",
"typescript": "2.3.4"
}
}
和karma.conf.js
:
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
},
{
pattern: './src/assets/**',
watched: false,
included: false,
nocache: false,
served: true
}
],
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,
autoWatchDelay: 1000,
browsers: ['Chrome'],
singleRun: false
});
};
答案 0 :(得分:0)
如果我对您的理解正确:
@MessageExceptionHandler()
public void errorHandler(Exception e, @Headers Map<String, Object> headers) {
LOGGER.error("Bad Packet received: ", e);
}
是您要寻找的。 p>
成功构建后,您可以将其链接为npm startup script,也可以使用其他工具(例如gulp或grunt)进行链接。