Flaky Test Prevention

Flaky tests destroy confidence. Quarantine them immediately — fix or delete, never ignore.

Rules:

  • Tests MUST NOT share mutable state (each test arranges its own)
  • Tests MUST NOT depend on execution order
  • Unit tests MUST NOT make real network calls (use fakes or stubs)
  • Tests MUST NOT use sleep() or timing-dependent assertions — use deterministic waits or callbacks
  • Unit tests MUST NOT produce filesystem side effects (use temp directories, clean up in teardown)
  • Tests SHOULD NOT rely on system clock — inject time as a dependency
  • If a test fails intermittently, it is broken. It MUST be treated as a P1 bug.

References:

version
1.0.0
platforms
typescript, web
tags
flaky-test-prevention, testing
author
Mike Fullerton
modified
2026-03-27

Change History

Version Date Author Summary
1.0.0 2026-03-27 Mike Fullerton Initial creation