Choosing between browserNoActivityTimeout and captureTimeout for CI flake reduction
0 reputation · 20 Sept 2026, 01:31 UTC
Karma's browserNoActivityTimeout and captureTimeout both govern how long the runner waits before treating a browser as unresponsive, yet they trigger at different stages of the test lifecycle. A CI pipeline needs deterministic job termination without failing legitimate slow tests, but the two settings interact in ways the documentation does not fully disambiguate.
Lowering browserNoActivityTimeout fails fast when a browser stalls during test execution, reducing hung jobs. However, it can also abort tests that are genuinely slow—such as large integration suites or tests that wait for async operations—producing false negatives. Raising captureTimeout gives browsers more time to start and connect, which helps on resource-constrained CI agents, but it extends the window before a launch failure is detected, potentially masking environment issues.
Because default values and flag handling have shifted across Karma major versions, a configuration that works on one release may behave differently on another. The trade-off is therefore version-sensitive and environment-dependent.
- Which timeout should be the primary lever for preventing indefinite CI hangs while preserving real test failures?
- How do you validate the chosen values against both fast unit suites and slower integration runs without introducing flakiness?