From e0ae45fd56c029ad071db1c0c0de0a6fa3d4a5ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulo=20Ara=C3=BAjo?= Date: Mon, 5 Oct 2026 11:35:43 +0200 Subject: [PATCH 1/2] test: wait for rules-proxy watchers before changing _redirects createRewriter starts its chokidar watchers without waiting for them to be ready. The reload test rewrote _redirects right after the first request, and on slow macOS runners that write sometimes landed before the watcher was armed, so the change was never reported and the test timed out (2 of the last 10 macOS unit runs). --- tests/unit/utils/rules-proxy.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/unit/utils/rules-proxy.test.ts b/tests/unit/utils/rules-proxy.test.ts index 2d6992d3328..db5c4e2e590 100644 --- a/tests/unit/utils/rules-proxy.test.ts +++ b/tests/unit/utils/rules-proxy.test.ts @@ -33,6 +33,15 @@ describe('createRewriter', () => { jwtSecret, projectDir, }) + // createRewriter doesn't wait for its file watchers, and a write before they're ready is never reported. + await Promise.all( + getWatchers().map( + (watcher) => + new Promise((resolve) => { + watcher.once('ready', resolve) + }), + ), + ) return { projectDir, rewriter } } From b9ae9fd2748c711b0fa030181f66629f789699f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paulo=20Ara=C3=BAjo?= Date: Mon, 5 Oct 2026 11:38:29 +0200 Subject: [PATCH 2/2] test: pass a zero-argument ready listener to chokidar chokidar types the 'ready' listener as () => void, so passing the Promise resolve function directly failed typecheck. --- tests/unit/utils/rules-proxy.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/unit/utils/rules-proxy.test.ts b/tests/unit/utils/rules-proxy.test.ts index db5c4e2e590..182d77e00c1 100644 --- a/tests/unit/utils/rules-proxy.test.ts +++ b/tests/unit/utils/rules-proxy.test.ts @@ -37,8 +37,10 @@ describe('createRewriter', () => { await Promise.all( getWatchers().map( (watcher) => - new Promise((resolve) => { - watcher.once('ready', resolve) + new Promise((resolve) => { + watcher.once('ready', () => { + resolve() + }) }), ), )