Mocha fails a test that takes longer than 2000 ms by default and highlights tests slower than 75 ms. Setting Scope How Timeout global --timeout 5000 or timeout: 5000 in .mocharc Timeout suite / test this.timeout(5000) (needs function, not arrow) Disable timeout debugging this.timeout(0) Slow threshold any this.slow(300) / --slow 300 Retries suite / test this.retries(2) / --retries 2 Retries help with genuinely flaky external dependencies (end-to-end tests), but they hide real bugs in unit tests — fix flakiness instead. For timers, use fake timers (Sinon) rather than real waits.
Key Takeaways
Default timeout is 2 s; raise it per test with this.timeout(ms).
this.retries(n) re-runs failing tests — use only for external flakiness.
this.slow(ms) tunes when a test is reported as slow.
Prefer fake timers over real sleeps to keep the suite fast.