Menu

I stopped re-running flaky tests and built an exorcist with Kiro
📰

I stopped re-running flaky tests and built an exorcist with Kiro

DEV Community: typescript·Ashwin·1 day ago
#XIipmQ3p
Long article (696 words) — no AI summary yet.
Reading 0:00
15s threshold

Every codebase I've worked on has had a ghost. It's a test that passes 29 times and fails on the 30th, usually on the run that matters. We all know the ritual: click re-run, see green, move on. Then the bigger teams add a quarantine list, and the ghost gets a room of its own.

For Kiroween 2026 I wanted to treat that ghost as what it really is: a deterministic bug hiding behind nondeterminism. A test only "flakes" because something outside it changes between runs. That might be the clock, the order tests run in, a timer firing a millisecond late, an unseeded random number, or a slow network call. If you control all of those, the ghost has nowhere to hide.

The four rites

Scan. POLTERGEIST installs a chaos layer under Vitest. Math.random is seeded, the clock can be shifted and the timezone changed, test order is shuffled from a seed, timers get jitter, and fetch gets latency. It runs your suite 30 times under random settings and draws a flicker strip per test.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.