cicd
test_execution
ai_generated
true
Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure 'done()' is called or return a Promise.
ID: cicd/test-flaky-timeout
78%Fix Rate
82%Confidence
50Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| any | active | — | — | — |
Root Cause
Tests intermittently fail with timeout errors in CI but pass locally. Caused by slower CI hardware, resource contention on shared runners, race conditions, or tests depending on external services.
genericWorkarounds
-
85% success Identify and fix the root cause of flakiness (race conditions, external dependencies)
Run tests with --verbose and timing output, identify tests that vary in duration. Replace real timers with fake timers, mock external API calls, use waitFor/eventually patterns for async assertions
-
82% success Quarantine flaky tests and track them separately while fixing
Tag flaky tests (e.g., @flaky or .skip) and run them in a separate non-blocking CI job. Track flaky test count as a metric and commit to fixing them on a schedule
Dead Ends
Common approaches that don't work:
-
Simply increase the test timeout to a very large value
60% fail
Masks the real issue (slow tests, resource contention, race conditions); makes CI feedback loops painfully slow and can hit job-level timeouts
-
Add automatic retry logic to re-run failed tests multiple times
50% fail
Retries hide genuine bugs, increase CI costs, and create false confidence in test results; flaky tests that occasionally pass are still broken
Error Chain
Leads to:
Preceded by:
Frequently confused with: