Skip to content

Commit 6366b7d

Browse files
sokraclaude
andcommitted
test(typed-routes): increase retry timeout to fix flakiness
The dev server emits "Ready in X" before `setupDevBundler` completes, so `routes.d.ts` may not exist yet when tests start polling. The default 3000ms retry window is too short on loaded CI runners. Increase the timeout to 30000ms for the three affected tests, and add a guard in `should have passing tsc after start` to ensure `routes.d.ts` is written before stopping the server and running tsc. Co-Authored-By: Claude <[email protected]>
1 parent 2ea43d6 commit 6366b7d

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

test/e2e/app-dir/typed-routes/typed-routes.test.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,21 @@ describe('typed-routes', () => {
2323
}
2424

2525
it('should generate route types correctly', async () => {
26+
// Route type generation happens after the "Ready" log fires; give it time.
2627
await retry(async () => {
2728
const dts = await next.readFile(`${next.distDir}/types/routes.d.ts`)
2829
expect(dts).toContain(expectedDts)
29-
})
30+
}, 30000)
3031
})
3132

3233
it('should have passing tsc after start', async () => {
34+
// Wait for routes.d.ts before stopping the server; route type generation
35+
// happens after the "Ready" log fires and tsc may run before it completes.
36+
await retry(async () => {
37+
const dts = await next.readFile(`${next.distDir}/types/routes.d.ts`)
38+
expect(dts).toContain(expectedDts)
39+
}, 30000)
40+
3341
await next.stop()
3442
try {
3543
const { stdout, stderr } = await execa('pnpm', ['tsc', '--noEmit'], {
@@ -47,6 +55,7 @@ describe('typed-routes', () => {
4755
})
4856

4957
it('should correctly convert custom route patterns from path-to-regexp to bracket syntax', async () => {
58+
// Route type generation happens after the "Ready" log fires; give it time.
5059
await retry(async () => {
5160
const dts = await next.readFile(`${next.distDir}/types/routes.d.ts`)
5261

@@ -59,7 +68,7 @@ describe('typed-routes', () => {
5968
// Test catch-all zero-or-more: :slug* -> [[...slug]]
6069
expect(dts).toContain('"/blog/[category]/[[...slug]]"')
6170
expect(dts).toContain('"/api-legacy/[version]/[[...endpoint]]"')
62-
})
71+
}, 30000)
6372
})
6473

6574
if (isNextDev) {

0 commit comments

Comments
 (0)