-
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.
Reland "Ensure bail out on ssr error in static generation" (#68999)
Relands #68764 -- no additional changes were made, the errors were expected due to faulty user code.
- Loading branch information
Showing
5 changed files
with
98 additions
and
27 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
7 changes: 7 additions & 0 deletions
7
test/production/app-dir/client-page-error-bailout/app/layout.js
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,7 @@ | ||
export default function Root({ children }) { | ||
return ( | ||
<html> | ||
<body>{children}</body> | ||
</html> | ||
) | ||
} |
5 changes: 5 additions & 0 deletions
5
test/production/app-dir/client-page-error-bailout/app/page.js
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') | ||
} |
29 changes: 29 additions & 0 deletions
29
test/production/app-dir/client-page-error-bailout/client-page-error-bailout.test.ts
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,29 @@ | ||
import { nextTestSetup } from 'e2e-utils' | ||
|
||
describe('app-dir - client-page-error-bailout', () => { | ||
const { next, skipped } = nextTestSetup({ | ||
files: __dirname, | ||
skipStart: true, | ||
}) | ||
|
||
if (skipped) { | ||
return | ||
} | ||
|
||
let stderr = '' | ||
beforeAll(() => { | ||
const onLog = (log: string) => { | ||
stderr += log | ||
} | ||
|
||
next.on('stderr', onLog) | ||
}) | ||
|
||
it('should bail out in static generation build', async () => { | ||
await next.build() | ||
expect(stderr).toContain( | ||
'Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error' | ||
) | ||
expect(stderr).toContain('Error: client-page-error') | ||
}) | ||
}) |