Skip to content

Commit bf26250

Browse files
committed
Update test expectation for PPR
1 parent e25c771 commit bf26250

File tree

1 file changed

+28
-47
lines changed

1 file changed

+28
-47
lines changed

test/e2e/app-dir/use-cache-hanging-inputs/use-cache-hanging-inputs.test.ts

Lines changed: 28 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import {
1010
} from 'next-test-utils'
1111
import stripAnsi from 'strip-ansi'
1212

13-
const isExperimentalReact = process.env.__NEXT_EXPERIMENTAL_PPR
14-
1513
const expectedTimeoutErrorMessage =
1614
'Filling a cache during prerender timed out, likely because request-specific arguments such as params, searchParams, cookies() or dynamic data were used inside "use cache".'
1715

@@ -271,55 +269,38 @@ describe('use-cache-hanging-inputs', () => {
271269

272270
const cliOutput = stripAnsi(next.cliOutput.slice(outputIndex))
273271

274-
if (isExperimentalReact) {
275-
// TODO(react-time-info): Remove this branch for experimental React when the issue is
276-
// resolved where the inclusion of server timings in the RSC payload
277-
// makes the serialized bound args not suitable to be used as a cache
278-
// key.
279-
280-
const expectedErrorMessagePpr =
281-
'Route "/bound-args": A component accessed data, headers, params, searchParams, or a short-lived cache without a Suspense boundary nor a "use cache" above it. We don\'t have the exact line number added to error messages yet but you can see which component in the stack below. See more info: https://nextjs.org/docs/messages/next-prerender-missing-suspense'
272+
expect(errorDescription).toBe(expectedTimeoutErrorMessage)
282273

283-
expect(errorDescription).toBe(expectedErrorMessagePpr)
274+
if (isTurbopack) {
275+
expect(errorSource).toMatchInlineSnapshot(`
276+
"app/bound-args/page.tsx (13:15) @ [project]/app/bound-args/page.tsx [app-rsc] (ecmascript)
277+
278+
11 | const uncachedDataPromise = fetchUncachedData()
279+
12 |
280+
> 13 | const Foo = async () => {
281+
| ^
282+
14 | 'use cache'
283+
15 |
284+
16 | return ("
285+
`)
284286

285-
expect(cliOutput).toContain(
286-
`${expectedErrorMessagePpr}
287-
at Page [Server] (<anonymous>)`
288-
)
289-
} else {
290-
expect(errorDescription).toBe(expectedTimeoutErrorMessage)
291-
292-
if (isTurbopack) {
293-
expect(errorSource).toMatchInlineSnapshot(`
294-
"app/bound-args/page.tsx (13:15) @ [project]/app/bound-args/page.tsx [app-rsc] (ecmascript)
295-
296-
11 | const uncachedDataPromise = fetchUncachedData()
297-
12 |
298-
> 13 | const Foo = async () => {
299-
| ^
300-
14 | 'use cache'
301-
15 |
302-
16 | return ("
303-
`)
304-
305-
expect(cliOutput).toContain(`Error: ${expectedTimeoutErrorMessage}
287+
expect(cliOutput).toContain(`Error: ${expectedTimeoutErrorMessage}
306288
at [project]/app/bound-args/page.tsx [app-rsc] (ecmascript)`)
307-
} else {
308-
expect(errorSource).toMatchInlineSnapshot(`
309-
"app/bound-args/page.tsx (13:15) @ eval
310-
311-
11 | const uncachedDataPromise = fetchUncachedData()
312-
12 |
313-
> 13 | const Foo = async () => {
314-
| ^
315-
14 | 'use cache'
316-
15 |
317-
16 | return ("
318-
`)
319-
320-
expect(cliOutput).toContain(`Error: ${expectedTimeoutErrorMessage}
289+
} else {
290+
expect(errorSource).toMatchInlineSnapshot(`
291+
"app/bound-args/page.tsx (13:15) @ eval
292+
293+
11 | const uncachedDataPromise = fetchUncachedData()
294+
12 |
295+
> 13 | const Foo = async () => {
296+
| ^
297+
14 | 'use cache'
298+
15 |
299+
16 | return ("
300+
`)
301+
302+
expect(cliOutput).toContain(`Error: ${expectedTimeoutErrorMessage}
321303
at eval (app/bound-args/page.tsx:13:14)`)
322-
}
323304
}
324305
}, 180_000)
325306
})

0 commit comments

Comments
 (0)