Skip to content

Commit 1db1762

Browse files
eps1lonztanner
andauthored
[test] Deflake prerender suite (#85563)
Co-authored-by: Zack Tanner <[email protected]>
1 parent cac2dd8 commit 1db1762

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

test/e2e/prerender.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -371,19 +371,19 @@ describe('Prerender', () => {
371371

372372
const navigateTest = (isDev = false) => {
373373
it('should navigate between pages successfully', async () => {
374-
const toBuild = [
375-
'/',
376-
'/another',
377-
'/something',
378-
'/normal',
379-
'/blog/post-1',
380-
'/blog/post-1/comment-1',
381-
'/catchall/first',
374+
// TODO: Compiling this many pages in parallel hits some race condition
375+
// causing "SyntaxError: Unexpected non-whitespace character after JSON at position 614"
376+
// which persists throughout Next.js Server instance lifetime.
377+
// Compiling in batches to avoid that unknown bug.
378+
const toBuildBatches = [
379+
['/', '/another', '/something', '/normal'],
380+
['/blog/post-1', '/blog/post-1/comment-1', '/catchall/first'],
382381
]
383382

384-
await waitFor(2500)
385-
386-
await Promise.all(toBuild.map((pg) => renderViaHTTP(next.url, pg)))
383+
for (const toBuild of toBuildBatches) {
384+
// eslint-disable-next-line no-loop-func -- we're not accessing `next` after the loop was exited.
385+
await Promise.all(toBuild.map((pg) => renderViaHTTP(next.url, pg)))
386+
}
387387

388388
const browser = await webdriver(next.url, '/')
389389
let text = await browser.elementByCss('p').text()

0 commit comments

Comments
 (0)