Skip to content

Commit 301df74

Browse files
committed
test(sync): bump flushWatchSetup ceiling 50 -> 250 to end whack-a-mole
The per-test bounded wait loops in the previous two commits only patched the two flaky call sites we had already seen. Another sibling test in the same describe block ("reloads sync config when .deepl-sync.yaml is one of the changed files") surfaced with the identical TypeError on Node 22 CI immediately after. Raise the helper's iteration budget at the source instead of adding a third bounded loop. Each round is two zero-work awaits (sub-microsecond), so 250 has negligible cost but absorbs the Node 22 + CI worker-contention tail that was pushing the setup chain past 50. Tests still fail loudly if setup never completes — the safety ceiling is just larger. The earlier bounded loops stay in place as belt-and-suspenders and as diagnostic breadcrumbs (they surface a clear length assertion rather than a misleading TypeError).
1 parent a5e2fd9 commit 301df74

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

tests/unit/sync/sync-command.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -794,11 +794,12 @@ describe('SyncCommand', () => {
794794
// fake timers, flushing that chain requires alternating microtask drains
795795
// (`await Promise.resolve()`) with zero-duration timer advances — timers
796796
// advance queued macrotasks, Promise.resolve drains microtask-only awaits.
797-
// 50 rounds is well above the ~10-level await depth of the setup chain,
798-
// giving parallel-load runs headroom (the previous 20-round count flaked
799-
// intermittently under heavy jest worker contention).
797+
// History: 20 rounds flaked → 50 rounds flaked under Node 22 CI worker
798+
// contention (sync-command.test.ts in PR 44). 250 gives ample headroom
799+
// (each round is sub-microsecond) without hiding real hangs — tests still
800+
// fail loudly if setup never finishes, just with a longer safety margin.
800801
async function flushWatchSetup(): Promise<void> {
801-
for (let i = 0; i < 50; i++) {
802+
for (let i = 0; i < 250; i++) {
802803
await Promise.resolve();
803804
await jest.advanceTimersByTimeAsync(0);
804805
}

0 commit comments

Comments
 (0)