karma-runner / karma

Spectacular Test Runner for JavaScript
http://karma-runner.github.io
MIT License
11.95k stars 1.71k forks source link

Karma always disconnects Chrome while CONFIGURING #3777

Open NingenJanai opened 2 years ago

NingenJanai commented 2 years ago

I upgraded to node 17, and now Karma tests won't run anymore, with node 16 they worked fine but now it seems Chrome is not able to configure anymore, because it always disconnects during the CONFIGURING part:

17 03 2022 13:03:57.251:DEBUG [karma-server]: A browser has connected on socket 5oDGuMCmOC3c73hcAAAB 17 03 2022 13:03:57.253:DEBUG [web-server]: upgrade /socket.io/?EIO=4&transport=websocket&sid=raqoNWSxu2VpgM5UAAAA 17 03 2022 13:03:57.267:DEBUG [Chrome Headless 96.0.4664.93 (Windows 10)]: undefined -> CONNECTED 17 03 2022 13:03:57.268:INFO [Chrome Headless 96.0.4664.93 (Windows 10)]: Connected on socket 5oDGuMCmOC3c73hcAAAB with id 69979605 17 03 2022 13:03:57.268:DEBUG [launcher]: BEING_CAPTURED -> CAPTURED 17 03 2022 13:03:57.269:DEBUG [launcher]: ChromeHeadless (id 69979605) captured in 3.014 secs 17 03 2022 13:03:57.269:DEBUG [Chrome Headless 96.0.4664.93 (Windows 10)]: CONNECTED -> CONFIGURING 17 03 2022 13:04:27.269:WARN [Chrome Headless 96.0.4664.93 (Windows 10)]: Disconnected (0 times) , because no message in 30000 ms. Chrome Headless 96.0.4664.93 (Windows 10) ERROR Disconnected , because no message in 30000 ms. 17 03 2022 13:04:27.270:DEBUG [Chrome Headless 96.0.4664.93 (Windows 10)]: CONFIGURING -> DISCONNECTED 17 03 2022 13:04:27.270:WARN [framework.snapshot]: Snapshot data is unavailable 17 03 2022 13:04:27.271:DEBUG [launcher]: CAPTURED -> BEING_KILLED 17 03 2022 13:04:27.271:DEBUG [launcher]: BEING_KILLED -> BEING_FORCE_KILLED 17 03 2022 13:04:27.271:DEBUG [Chrome Headless 96.0.4664.93 (Windows 10)]: DISCONNECTED -> DISCONNECTED

pitAlex commented 2 years ago

@NingenJanai how did you make it run on node16? I am constantly getting disconnect message with a timeout.

NingenJanai commented 2 years ago

I´m not using karma anymore, I now use @web/test-runner, couldn´t solve the issue with karma, sorry.

Kind regards.

0x80085 commented 2 years ago

having this same issue - tests had no problems for YEARS and now since a few days they won't even start ... because chromeheadless disconnects while CONFIGURING.. reproducable locally and on build machines

Quentame commented 1 year ago

Same for me, fresh install of Angular app, launching tests (karma on Chrome) ==> not working

logs:

$ npx ng test
√ Browser application bundle generation complete.
20 10 2022 11:19:57.833:INFO [karma-server]: Karma v6.4.1 server started at http://localhost:9876/
20 10 2022 11:19:57.840:INFO [launcher]: Launching browsers Chrome with concurrency unlimited
20 10 2022 11:19:57.858:INFO [launcher]: Starting browser Chrome
20 10 2022 11:20:57.862:WARN [launcher]: Chrome has not captured in 60000 ms, killing.
20 10 2022 11:20:58.529:INFO [launcher]: Trying to start Chrome again (1/2).
20 10 2022 11:21:58.530:WARN [launcher]: Chrome has not captured in 60000 ms, killing.
20 10 2022 11:21:59.086:INFO [launcher]: Trying to start Chrome again (2/2).
20 10 2022 11:22:59.087:WARN [launcher]: Chrome has not captured in 60000 ms, killing.
20 10 2022 11:22:59.629:ERROR [launcher]: Chrome failed 2 times (timeout). Giving up.

There is no Connected on socket ...

Chrome did launch but with an error (see tab icon): image

deps:

    "@angular/core": "^14.2.0",
    "@angular/cli": "~14.2.6",
    "karma": "~6.4.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-firefox-launcher": "^2.1.2",
    "puppeteer": "^19.0.0",

Also tried puppeteer but the result is the same. When installing Firefox launcher ==> working out of the box

logs using Firefox:

$ npx ng test
√ Browser application bundle generation complete.
20 10 2022 11:26:03.173:INFO [karma-server]: Karma v6.4.1 server started at http://localhost:9876/
20 10 2022 11:26:03.184:INFO [launcher]: Launching browsers Firefox with concurrency unlimited
20 10 2022 11:26:03.194:INFO [launcher]: Starting browser Firefox
20 10 2022 11:26:08.005:INFO [Firefox 102.0 (Windows 10)]: Connected on socket 4A2tcBoN30iScd2QAAAB with id 33534128
Firefox 102.0 (Windows 10): Executed 3 of 3 SUCCESS (0.231 secs / 0.219 secs)
TOTAL: 3 SUCCESS

Browser versions: