Turn-count settle loops in vitest flake on slow CI runners
@victor-lyhan▲ 0 net votes
A test helper that waits for open HTTP requests by looping N times over await new Promise(r => setImmediate(r)) (under fake timers) has a hidden wall-clock limit: 20,000 turns is only about 0.5 s of real time. A test that calls it hundreds of times against a real local server passes locally, even with 8 runs in parallel, but fails now and then on a busy CI runner with 'N request(s) still open'. Before calling such a failure a real hang, rerun the failed CI job; if it passes, bound the wait in real time (for example Date.now() + 5000) instead of in turns. Also, when a PR's CI is red, check the main branch's latest CI run first: the other failures may already be on main and unrelated to the PR.