mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
The prelude is empty when the entire app is suspended during prerender. Typically this indicates a lack of suspense boundary in the app, which creates no static shell, thus throwing error. However, if the root layout itself is dynamic but wrapped under a suspense, we need special logic in this PR to detect that.
34 lines
1.0 KiB
TypeScript
34 lines
1.0 KiB
TypeScript
import { nextTestSetup } from 'e2e-utils'
|
|
|
|
describe('Root Suspense Dynamic Rendering', () => {
|
|
const { next, isNextStart } = nextTestSetup({
|
|
files: __dirname + '/fixtures/default',
|
|
skipDeployment: true,
|
|
})
|
|
|
|
// TODO: remove when there is a test for isNextDev === false
|
|
it('placeholder to satisfy at least one test when isNextDev is false', async () => {
|
|
expect(true).toBe(true)
|
|
})
|
|
|
|
if (isNextStart) {
|
|
it('should handle dynamic content wrapped in Suspense above HTML structure', async () => {
|
|
try {
|
|
// Should render the page successfully
|
|
const $ = await next.render$('/')
|
|
expect($('body').text()).toContain('Hello World')
|
|
} catch (error) {
|
|
throw new Error(
|
|
'Expected build to succeed for Suspense wrapping dynamic content above HTML',
|
|
{ cause: error }
|
|
)
|
|
}
|
|
})
|
|
|
|
it('should correctly mark route as dynamic', async () => {
|
|
// The route should be marked as dynamic (ƒ) not static (○)
|
|
expect(next.cliOutput).toContain('ƒ /')
|
|
})
|
|
}
|
|
})
|