Test 002: Flaky by Design
Another placeholder — here to show how a second entry stacks up in the log. The topic is real even if the words aren’t yet: a flaky test isn’t random, it’s a race condition you haven’t named.
# the test that passes on your machine
PASS checkout.spec.ts (local, run 1)
FAIL checkout.spec.ts (ci, run 2)
FAIL checkout.spec.ts (ci, run 3)
PASS checkout.spec.ts (ci, run 4)
# ...this is the bug, not the weather
The lie
“It’s just flaky” is the most expensive sentence in a test suite. It teaches the team to re-run until green, which teaches the suite that failure is optional, which is how a real regression sails through behind a retry button.
The usual suspects
- Time —
sleep(500)is a bet that the machine is never busy. It loses on CI. - Order — tests that share state pass alone and fail in a crowd.
- Network — a real call where a stub belonged.
- Animation — clicking an element mid-transition, before it’s where you think it is.
The pin-down
- Reproduce it on purpose — loop the test 100× until it fails on command.
- Replace every wait-for-time with a wait-for-condition.
- Isolate state so order can’t matter.
- Quarantine, never ignore — a skipped flake is a bug with a hat on.
A retry is a snooze button. Sometimes you need sleep; mostly you need to fix the alarm.
Status
Placeholder for now — the real version comes with an actual failing test and the diff that fixed it. Until then, take the checklist and go pin something down. Questions go to the usual inbox.
← back to the log