Skip to content

Commit

Permalink
organize test
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi committed Jul 13, 2023
1 parent 292be8f commit 782d48e
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 4 deletions.
File renamed without changes.
File renamed without changes.
14 changes: 14 additions & 0 deletions test/e2e/app-dir/global-error/layout-error/app/global-error.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use client'

export default function GlobalError({ error }) {
return (
<html>
<head></head>
<body>
<h1>Global Error</h1>
<p id="error">{`Global error: ${error?.message}`}</p>
{error?.digest && <p id="digest">{error?.digest}</p>}
</body>
</html>
)
}
5 changes: 5 additions & 0 deletions test/e2e/app-dir/global-error/layout-error/app/layout.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export default function layout() {
throw new Error('Global error: layout error')
}

export const revalidate = 0
3 changes: 3 additions & 0 deletions test/e2e/app-dir/global-error/layout-error/app/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export default function page() {
return <div>Page</div>
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ async function testDev(browser, 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> }`,
},
files: __dirname,
skipDeployment: true,
},
({ next, isNextDev }) => {
it('should render global error for error in server components', async () => {
Expand Down

0 comments on commit 782d48e

Please sign in to comment.