Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: re-enable test with note #71789

Merged
merged 2 commits into from
Oct 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ describe('Dynamic IO Dev Errors', () => {
})
})

// Disabling so I can land docs update. reenable after
it.skip('should display error when component accessed data without suspense boundary', async () => {
// NOTE: when update this snapshot, use `pnpm build` in packages/next to avoid next source code get mapped to source.
it('should display error when component accessed data without suspense boundary', async () => {
const browser = await next.browser('/no-accessed-data')

await retry(async () => {
Expand All @@ -57,39 +57,14 @@ describe('Dynamic IO Dev Errors', () => {

const description = await getRedboxDescription(browser)
const stack = await getRedboxCallStack(browser)
const result = {
description,
stack,
}

expect(result).toMatchInlineSnapshot(`
{
"description": "[ Server ] Error: Route "/no-accessed-data": 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",
"stack": "Page [Server]
<anonymous> (2:1)
Root [Server]
<anonymous> (2:1)
RedirectErrorBoundary
./dist/esm/server/route-modules/app-page/module.js
RedirectBoundary
./dist/esm/server/route-modules/app-page/module.js
ReactDevOverlay
./dist/esm/client/components/react-dev-overlay/app/hot-reloader-client.js
HotReload
./dist/esm/client/components/react-dev-overlay/app/hot-reloader-client.js
Router
./dist/esm/server/route-modules/app-page/module.js
ErrorBoundaryHandler
./dist/esm/server/route-modules/app-page/module.js
ErrorBoundary
./dist/esm/server/route-modules/app-page/module.js
AppRouter
./dist/esm/server/route-modules/app-page/module.js
ServerInsertedHTMLProvider
./dist/esm/server/route-modules/app-page/module.js
App
./dist/esm/server/route-modules/app-page/module.js",
}
`)
expect(description).toMatchInlineSnapshot(
`"[ Server ] Error: Route "/no-accessed-data": 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"`
)
// TODO: use snapshot testing for stack
// FIXME: avoid `next` code to be mapped to source code and filter them out even when sourcemap is enabled.
expect(stack).toContain('Page [Server]')
expect(stack).toContain('Root [Server]')
expect(stack).toContain('<anonymous> (2:1)')
})
})
Loading