Ser*_*gey 2 typescript karma-runner angular
我在 Angular 6 上有一个现有项目,其中测试未运行。它是如何发生的:在 PhpStorm 中,我按下文件上的上下文菜单run file.specs.ts。
它开始测试,打开浏览器,然后什么也没发生。这是日志
Waiting for a captured browser... To capture a browser open http://localhost:9876/
14 10 2018 13:04:17.500:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
14 10 2018 13:04:17.799:INFO [launcher]: Trying to start Chrome again (1/2).
14 10 2018 13:05:17.808:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
14 10 2018 13:05:18.055:INFO [launcher]: Trying to start Chrome again (2/2).
14 10 2018 13:06:18.062:WARN [launcher]: Chrome have not captured in 60000 ms, killing.
14 10 2018 13:06:18.199:ERROR [launcher]: Chrome failed 2 times (timeout). Giving up.
Run Code Online (Sandbox Code Playgroud)
我如何找出这些测试有什么问题?我没有看到有关依赖项或其他方面的错误。有没有机会找到导致无法捕获浏览器的原因?
在这个项目中,所有spec.tss 都丢失了(看起来有人删除了它们),所以我尝试运行那些在新组件/服务上创建的。
没有这样的选项来启动新项目。我必须解决这个问题。
任何帮助将不胜感激。
// 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-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
},
coverageIstanbulReporter: {
dir: require('path').join(__dirname, '../coverage'),
reports: ['html', 'lcovonly'],
fixWebpackSourcePaths: true
},
reporters: ['progress', 'kjhtml'],
port: 9876,
colors: true,
logLevel: config.LOG_INFO,
autoWatch: true,
browsers: ['Chrome'],
singleRun: false
});
};
Run Code Online (Sandbox Code Playgroud)
问题很简单,运行ng test. 有一些应用程序级别的错误会破坏 Jasmine init(虽然我不明白为什么当我尝试在 PhpStorm 中对单个文件运行测试时它不起作用)。因此,当我解决该问题时,我的测试开始工作以及单一测试(在浏览器中它们显示为全部运行)
| 归档时间: |
|
| 查看次数: |
5989 次 |
| 最近记录: |