Skip to content

Commit 9fa2967

Browse files
authored
test: wait for rules-proxy watchers before changing _redirects (#8560)
1 parent 086fbfc commit 9fa2967

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎tests/unit/utils/rules-proxy.test.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ describe('createRewriter', () => {
3333
jwtSecret,
3434
projectDir,
3535
})
36+
// createRewriter doesn't wait for its file watchers, and a write before they're ready is never reported.
37+
await Promise.all(
38+
getWatchers().map(
39+
(watcher) =>
40+
new Promise<void>((resolve) => {
41+
watcher.once('ready', () => {
42+
resolve()
43+
})
44+
}),
45+
),
46+
)
3647
return { projectDir, rewriter }
3748
}
3849

0 commit comments

Comments
 (0)