加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular – 无法将浏览器连接到Karma服务器(永久页面加载)

发布时间:2020-12-17 07:06:57 所属栏目:安全 来源:网络整理
导读:我正在使用IntelliJ启动Karma.一切看起来都不错,新的Chrome窗口弹出,但它会永远保持加载状态. 业力日志: 17 07 2018 13:29:01.754:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9877/17 07 2018 13:29:01.758:INFO [launcher]: Launching
我正在使用IntelliJ启动Karma.一切看起来都不错,新的Chrome窗口弹出,但它会永远保持加载状态.

业力日志:

17 07 2018 13:29:01.754:INFO [karma]: Karma v1.7.1 server started at http://0.0.0.0:9877/
17 07 2018 13:29:01.758:INFO [launcher]: Launching browser Chrome with unlimited concurrency
17 07 2018 13:29:01.773:INFO [launcher]: Starting browser Chrome

 10% building modules 1/3 modules 2 active …tsrafa-components-libsrcpolyfills.ts
 10% building modules 2/3 modules 1 active …tsrafa-components-libsrcpolyfills.ts
 75% basic chunk optimization EnsureChunkConditionsPlugin
 75% basic chunk optimization RemoveParentModulesPlugin
 88% hashing
 90% additional chunk assets processing
 92% after chunk asset optimization SourceMapDevToolPlugin main.js generate SourceMap
Waiting for a captured browser... To capture a browser open http://localhost:9877/

访问localhost:9877会导致永久加载.有时它按预期工作(业力开始和浏览器连接)但它有点随机.

也许有人知道发生了什么?

Karma配置:

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: 9877,colors: true,logLevel: config.LOG_INFO,autoWatch: true,browsers: ['Chrome'],singleRun: false
  });
};

新的浏览器窗口:

enter image description here

建立连接:

enter image description here

解决方法

我在Webstorm中遇到了同样的问题.

我的测试中有编译问题,在我的情况下,它在node_modules / rxjs / Observable.d.ts(1,15)中是错误的:错误TS2307:找不到模块’rxjs-compat / Observable’..

在Webstorm控制台中,仅在第三次无法捕获浏览器后才显示错误.运行测试时,您将立即看到编译错误.解决之后,测试在Webstorm中运行得很好.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读