Karma: “Disconnectedreconnect failed before timeout of” with ChromeHeadless

浪尽此生 提交于 2021-01-27 22:11:42

问题


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.


回答1:


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

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

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

  • disable-gpu flag disables GPU hardware acceleration
  • no-sandbox disables the sandbox for all process that are normally sandboxed.

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



来源:https://stackoverflow.com/questions/58484124/karma-disconnectedreconnect-failed-before-timeout-of-with-chromeheadless

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!