It usually happens only in Jenkins, and to me it seems that Karma is trying to launch testing while the generating bundle process is on its way to get completed, so I was wondering whether there is a way to make Karma to use an existing bundle, or generate a bundle first and then launch karma using that bundle.

Error

[2021-06-10T15:51:24.567Z] [Exec Stream Pumper] [INFO] - Generating browser application bundles...
[2021-06-10T15:51:25.504Z] [Exec Stream Pumper] [INFO] 10 06 2021 15:51:25.405:INFO [karma-server]: Karma v6.1.2 server started at http://localhost:9876/
[2021-06-10T15:51:25.504Z] [Exec Stream Pumper] [INFO] 10 06 2021 15:51:25.409:INFO [launcher]: Launching browsers ChromiumHeadless with concurrency unlimited
[2021-06-10T15:51:25.504Z] [Exec Stream Pumper] [INFO] 10 06 2021 15:51:25.423:INFO [launcher]: Starting browser ChromiumHeadless
[2021-06-10T15:52:26.231Z] [Exec Stream Pumper] [INFO] 10 06 2021 15:52:26.168:WARN [launcher]: ChromiumHeadless have not captured in 60000 ms, killing.
[2021-06-10T15:52:33.103Z]  at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFi[Exec Stream Pumper] [INFO] 10 06 2021 15:52:32.846:INFO [launcher]: Trying to start ChromiumHeadless again (1/5).
[2021-06-10T15:53:48.835Z] [Exec Stream Pumper] [INFO] 10 06 2021 15:53:47.634:WARN [launcher]: ChromiumHeadless have not captured in 60000 ms, killing.
[2021-06-10T15:53:51.370Z] [Exec Stream Pumper] [INFO] 10 06 2021 15:53:51.295:INFO [launcher]: Trying to start ChromiumHeadless again (2/5).
[2021-06-10T15:54:48.318Z] [Exec Stream Pumper] [INFO] ✔ Browser application bundle generation complete.

I don't know if this is related with the fact that it takes 3min to generate the bundle.

package.json

"karma": "~6.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"karma-junit-reporter": "^2.0.1",
"karma-spec-reporter": "0.0.32"
1

There are 1 best solutions below

3
AliF50 On

Does this happen locally as well? How many unit tests do you have?

Try updating karma-chrome-launcher and maybe karma as well in package.json.

If it happens only on Jenkins, then I think you need a computer/agent on Jenkins with better CPU and more RAM.