Files
Will Binns-SmithandGitHub f9aec9005a Turbopack: Trace edge runtime app render errors through source maps (#62901)
Similar to #62611, this implements error stack translation for edge
runtime app render errors.

Test Plan: `TURBOPACK=1 pnpm test-dev
test/development/app-render-error-log/app-render-error-log.test.ts`

Closes PACK-2665
2024-03-05 20:40:26 -08:00

43 lines
1.5 KiB
TypeScript

import { createNextDescribe } from 'e2e-utils'
import { check } from 'next-test-utils'
createNextDescribe(
'app-render-error-log',
{
files: __dirname,
},
({ next }) => {
it('should log the correct values on app-render error', async () => {
const outputIndex = next.cliOutput.length
await next.fetch('/')
await check(() => next.cliOutput.slice(outputIndex), /at Page/)
const cliOutput = next.cliOutput.slice(outputIndex)
await check(() => cliOutput, /digest:/)
expect(cliOutput).toInclude('Error: boom')
expect(cliOutput).toInclude('at fn2 (./app/fn.ts')
expect(cliOutput).toMatch(/at (Module\.)?fn1 \(\.\/app\/fn\.ts/)
expect(cliOutput).toInclude('at Page (./app/page.tsx')
expect(cliOutput).not.toInclude('webpack-internal')
})
it('should log the correct values on app-render error with edge runtime', async () => {
const outputIndex = next.cliOutput.length
await next.fetch('/edge')
await check(() => next.cliOutput.slice(outputIndex), /at EdgePage/)
const cliOutput = next.cliOutput.slice(outputIndex)
await check(() => cliOutput, /digest:/)
expect(cliOutput).toInclude('Error: boom')
expect(cliOutput).toInclude('at fn2 (./app/fn.ts')
expect(cliOutput).toMatch(/at (Module\.)?fn1 \(\.\/app\/fn\.ts/)
expect(cliOutput).toInclude('at EdgePage (./app/edge/page.tsx')
expect(cliOutput).not.toInclude('webpack-internal')
})
}
)