b5f7f84485
Same purpose as #48297, but without the React channel branching logic to make it easier to land. Since we have #48478 reverted, we only need to consider `pages` and `app` inside the require hook. > This PR aims to improve the current require hook by implementing two key changes. Firstly, it ensures that the initialization occurs at the top of the module level for correctness. Secondly, we now set the NEXT_PREBUNDLED_REACT environment variable at the process level to ensure that we don't mix the two types of rendering processes and we always resolve the correct React package. > > These improvements are made possible by the changes introduced in PR https://github.com/vercel/next.js/pull/47857. > > Closes [NEXT-231](https://linear.app/vercel/issue/NEXT-231). This will likely fix #45258 too. --------- Co-authored-by: JJ Kasper <jj@jjsweb.site>
42 lines
1.4 KiB
TypeScript
42 lines
1.4 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).toInclude('at 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).toInclude('at fn1 (./app/fn.ts')
|
|
expect(cliOutput).toInclude('at EdgePage (./app/edge/page.tsx')
|
|
|
|
expect(cliOutput).not.toInclude('webpack-internal')
|
|
})
|
|
}
|
|
)
|