> snackdriven.com

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

The pin-down

  1. Reproduce it on purpose — loop the test 100× until it fails on command.
  2. Replace every wait-for-time with a wait-for-condition.
  3. Isolate state so order can’t matter.
  4. 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