test(cli): fix flaky rename watch test with deterministic waiter polling
The rename test relied on a fixed 300ms setTimeout to fire after the CLI subprocess had registered its waiter — adequate in isolation but flaky under full-suite load on Windows (CLI spawn + first HTTP request can exceed 300ms). Add a tiny public MailboxStore.waiterCount(name) helper so the test can poll until the waiter is actually registered before triggering the rename. Also tighten the missing-name assertion from not-zero to the contract-exact exit code 1. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -294,6 +294,10 @@ export class MailboxStore {
|
||||
this.waiters.delete(oldName);
|
||||
}
|
||||
|
||||
waiterCount(name: string): number {
|
||||
return this.waiters.get(name)?.size ?? 0;
|
||||
}
|
||||
|
||||
rejectAllWaiters(): void {
|
||||
for (const bucket of this.waiters.values()) {
|
||||
for (const w of bucket) w.resolve({ kind: "aborted" });
|
||||
|
||||
Reference in New Issue
Block a user