karma-runner / karma-runner/karma

Unit Tests Sporadically Disconnect on our CI:CD builds

Open
#3,820 9 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Hi Karma team,

I'm part of an Angular project for my organization with a CI:CD build running approx. 1260 unit tests. We run these unit tests as part of a nightly build.

Our builds run the following command to launch the unit tests:
ng test [project_name] --browsers=ChromeHeadless --watch=false --source-map=false

After 921 passing tests, the unit test portion of our build fails with the following error:
Disconnected (0 times) reconnect failed before timeout of 2000ms (ping timeout)

This issue happens *only* on CI:CD, I never get it locally when running unit tests on my machine. Even then, we don't get this for *every* build. It happens randomly.

We're using Angular version 13.2.6 and the following Karma versions:
"karma": "~6.3.17",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.1",
"karma-jasmine-html-reporter": "^1.7.0",
"karma-scss-preprocessor": "^4.0.0",

What are some potential root causes we can troubleshoot to better understand why the unit tests randomly disconnect. Please advise. Thank you!

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the reported `ng test [project_name] --browsers=ChromeHeadless --watch=false --source-map=false` command in the CI environment and compare its logs with a successful run. The issue names no repository files or failing test; done means identifying a reproducible cause for the intermittent disconnect and documenting an actionable fix or configuration change.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, javascript
Domain
ci-cd, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.