因果关系:"Disconnectedreconnect在超时之前失败"使用ChromeHeadless [英] Karma: "Disconnectedreconnect failed before timeout of" with ChromeHeadless

查看:183
本文介绍了因果关系:"Disconnectedreconnect在超时之前失败"使用ChromeHeadless的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的AngularJS中,运行测试时npm超时,并显示消息"Xs超时之前Disconnectedreconnect失败". 我的karma.conf.js文件配置如下:

In my AngularJS, npm times out when running tests, with message "Disconnectedreconnect failed before timeout of Xs" . My karma.conf.js file is configured as such:

...
browserDisconnectTimeout: 10000,
browserDisconnectTolerance: 3,
browserNoActivityTimeout: 100000,
...

增加这些值无济于事-在新指定的时间段后将出现相同的错误.

Increasing these values didn't help - the same error would appear after the newly specified amount of time.

推荐答案

我通过将其添加到我的karma.conf.js文件(在browserNoActivityTimeout属性下方)解决了该问题.

I solved it by adding this to my karma.conf.js file, below the browserNoActivityTimeout property.

flags: [
    '--disable-gpu',
    '--no-sandbox'
]

来自 https://peter.sh/experiments/chromium-command-line -switches/:

  • disable-gpu标志禁用GPU硬件加速
  • no-sandbox禁用所有通常被沙盒化的进程的沙盒.

我必须同时使用这两种方法才能消除项目中的超时.

I had to use both of these in combination to eradicate the timeout in my project.

这篇关于因果关系:"Disconnectedreconnect在超时之前失败"使用ChromeHeadless的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆