Skip to content

Commit

Permalink
Add failing test for top-level errors with dynamicIO
Browse files Browse the repository at this point in the history
  • Loading branch information
unstubbable committed Dec 6, 2024
1 parent 957e3ed commit fd18c85
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default async function Page() {
throw new Error('Kaputt!')

return <p>This page always errors.</p>
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ describe('Dynamic IO Dev Errors', () => {
)
})

it('should not log unhandled rejections for persistently thrown top-level errors', async () => {
const cliOutputLength = next.cliOutput.length
const res = await next.fetch('/top-level-error')
expect(res.status).toBe(500)

await retry(() => {
const cliOutput = next.cliOutput.slice(cliOutputLength)
expect(cliOutput).toContain('GET /top-level-error 500')
})

expect(next.cliOutput.slice(cliOutputLength)).not.toContain(
'unhandledRejection'
)
})

// 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 outputIndex = next.cliOutput.length
Expand Down

0 comments on commit fd18c85

Please sign in to comment.