Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Karma: "Disconnectedreconnect failed before timeout of" with ChromeHeadless

Tags:

karma-runner

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.

like image 451
Chris Neve Avatar asked Nov 06 '22 13:11

Chris Neve


1 Answers

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.

like image 104
Chris Neve Avatar answered Nov 22 '22 05:11

Chris Neve