我已将我的项目转换为angular 4 / angular-cli 1.0.0从那时起,当我想要运行测试时,我有一个奇怪的行为
我的配置:
@angular/cli: 1.0.1
node: 7.8.0
os: win32 x64
@angular/common: 4.0.3
@angular/compiler: 4.0.3
@angular/core: 4.0.3
@angular/forms: 4.0.3
@angular/http: 4.0.3
@angular/platform-browser: 4.0.3
@angular/platform-browser-dynamic: 4.0.3
@angular/router: 4.0.3
@angular/cli: 1.0.1
@angular/compiler-cli: 4.0.3
我的karma.config.js
module.exports = function (config) {
config.set({
basePath: '',
frameworks: ['jasmine', '@angular/cli'],
plugins: [
require('karma-jasmine'),
require('karma-phantomjs-launcher'),
require('karma-firefox-launcher'),
require('karma-chrome-launcher'),
require('@angular/cli/plugins/karma'),
require('karma-jasmine-html-reporter'),
require('karma-coverage-istanbul-reporter')
],
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' ]
},
reporters: config.angularCli && config.angularCli.codeCoverage
? ['progress', 'coverage-istanbul']
: ['progress'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['PhantomJS','Firefox','Chrome'],
singleRun: false
});
};
当我使用ng测试启动测试时 - 浏览器Chrome 没有试运行(坚果没有错误),似乎他没有找到任何测试
确实,在浏览器中,我没有看到我的javascripts但是当我修改junit test之一(带编辑器的xxx.psec.ts)时(通过添加空格行), javascripts在浏览器中加载
为什么我的测试不是第一次运行?