-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into fix-form-data-route-handler-documentation
- Loading branch information
Showing
11 changed files
with
161 additions
and
56 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
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
File renamed without changes.
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 |
---|---|---|
|
@@ -6,3 +6,5 @@ export default function Layout({ children }) { | |
</html> | ||
) | ||
} | ||
|
||
export const revalidate = 0 |
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,5 @@ | ||
'use client' | ||
|
||
export default function page() { | ||
throw new Error('client page error') | ||
} |
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,3 @@ | ||
export default function page() { | ||
throw new Error('server page error') | ||
} |
This file was deleted.
Oops, something went wrong.
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,61 @@ | ||
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', | ||
{ | ||
files: __dirname, | ||
}, | ||
({ next, isNextDev }) => { | ||
it('should trigger error component when an error happens during rendering', async () => { | ||
const browser = await next.browser('/client') | ||
await browser | ||
.waitForElementByCss('#error-trigger-button') | ||
.elementByCss('#error-trigger-button') | ||
.click() | ||
|
||
if (isNextDev) { | ||
await testDev(browser, /Error: Client error/) | ||
} else { | ||
await browser | ||
expect(await browser.elementByCss('#error').text()).toBe( | ||
'Global error: Client error' | ||
) | ||
} | ||
}) | ||
|
||
it('should render global error for error in server components', async () => { | ||
const browser = await next.browser('/ssr/server') | ||
|
||
if (isNextDev) { | ||
await testDev(browser, /Error: server page 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+/) | ||
} | ||
}) | ||
|
||
it('should render global error for error in client components', async () => { | ||
const browser = await next.browser('/ssr/client') | ||
|
||
if (isNextDev) { | ||
await testDev(browser, /Error: client page error/) | ||
} else { | ||
expect(await browser.elementByCss('h1').text()).toBe('Global Error') | ||
expect(await browser.elementByCss('#error').text()).toBe( | ||
'Global error: client page error' | ||
) | ||
|
||
expect(await browser.hasElementByCssSelector('#digest')).toBeFalsy() | ||
} | ||
}) | ||
} | ||
) |