-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
test/e2e/app-dir/error-boundary-and-not-found-linking/app/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { getRedboxHeader, hasRedbox } from 'next-test-utils' | ||
import { createNextDescribe } from 'e2e-utils' | ||
|
||
async function testDev(browser, errorRegex) { | ||
expect(await hasRedbox(browser, true)).toBe(true) | ||
expect(await getRedboxHeader(browser)).toMatch(errorRegex) | ||
} | ||
|
||
createNextDescribe( | ||
'app dir - global error - layout error', | ||
{ | ||
files: { | ||
'app/layout.js': `throw new Error('Global error: layout error')`, | ||
'app/page.js': `export default function page() { return <div id="page">Page</div> }`, | ||
}, | ||
}, | ||
({ next, isNextDev }) => { | ||
it('should render global error for error in server components', async () => { | ||
const browser = await next.browser('/') | ||
|
||
if (isNextDev) { | ||
await testDev(browser, /Global error: layout error/) | ||
} else { | ||
expect(await browser.elementByCss('h1').text()).toBe('Global Error') | ||
expect(await browser.elementByCss('#error').text()).toBe( | ||
'Global error: An error occurred in the Server Components render. The specific message is omitted in production builds to avoid leaking sensitive details. A digest property is included on this error instance which may provide additional details about the nature of the error.' | ||
) | ||
expect(await browser.elementByCss('#digest').text()).toMatch(/\w+/) | ||
} | ||
}) | ||
} | ||
) |