mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
[diff facebook/[email protected]](https://github.com/facebook/react/compare/fef12a01...da9325b5) <details> <summary>React upstream changes</summary> - https://github.com/facebook/react/pull/35962 - https://github.com/facebook/react/pull/35961 - https://github.com/facebook/react/pull/36277 - https://github.com/facebook/react/pull/36297 - https://github.com/facebook/react/pull/36292 - https://github.com/facebook/react/pull/36291 - https://github.com/facebook/react/pull/36196 - https://github.com/facebook/react/pull/36246 - https://github.com/facebook/react/pull/36287 - https://github.com/facebook/react/pull/36285 - https://github.com/facebook/react/pull/36274 - https://github.com/facebook/react/pull/36266 - https://github.com/facebook/react/pull/36253 </details>
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('app dir - global error - layout error', () => {
|
|
const { next, isNextDev, skipped } = nextTestSetup({
|
|
files: __dirname,
|
|
skipDeployment: true,
|
|
})
|
|
|
|
if (skipped) {
|
|
return
|
|
}
|
|
|
|
it('should render global error for error in server components', async () => {
|
|
const browser = await next.browser('/')
|
|
|
|
if (isNextDev) {
|
|
await expect(browser).toDisplayRedbox(`
|
|
{
|
|
"description": "layout error",
|
|
"environmentLabel": "Server",
|
|
"label": "Runtime Error",
|
|
"source": "app/layout.js (2:9) @ layout
|
|
> 2 | throw new Error('layout error')
|
|
| ^",
|
|
"stack": [
|
|
"layout app/layout.js (2:9)",
|
|
],
|
|
}
|
|
`)
|
|
}
|
|
|
|
expect(await browser.elementByCss('h1').text()).toBe('Global Error')
|
|
expect(await browser.elementByCss('#error').text()).toBe(
|
|
isNextDev
|
|
? 'Global error: layout error'
|
|
: 'Global error: Minified React error #441; visit https://react.dev/errors/441 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.'
|
|
)
|
|
expect(await browser.elementByCss('#digest').text()).toMatch(/\w+/)
|
|
})
|
|
})
|