Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable dynamic HTML in minimal mode (#34222)
Follow up for #34068 Let minimalMode render HTML by streaming facilities
- Loading branch information
Showing
2 changed files
with
45 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { createNext } from 'e2e-utils' | ||
import { NextInstance } from 'test/lib/next-modes/base' | ||
import { renderViaHTTP } from 'next-test-utils' | ||
|
||
describe('react-18-streaming-ssr in minimal mode', () => { | ||
let next: NextInstance | ||
|
||
beforeAll(async () => { | ||
process.env.NEXT_PRIVATE_MINIMAL_MODE = '1' | ||
|
||
next = await createNext({ | ||
files: { | ||
'pages/index.server.js': ` | ||
export default function Page() { | ||
return <p>static streaming</p> | ||
} | ||
`, | ||
}, | ||
nextConfig: { | ||
experimental: { | ||
reactRoot: true, | ||
serverComponents: true, | ||
runtime: 'nodejs', | ||
}, | ||
}, | ||
dependencies: { | ||
react: '18.0.0-rc.0', | ||
'react-dom': '18.0.0-rc.0', | ||
}, | ||
skipStart: true, | ||
}) | ||
|
||
await next.start() | ||
}) | ||
afterAll(() => { | ||
delete process.env.NEXT_PRIVATE_MINIMAL_MODE | ||
next.destroy() | ||
}) | ||
|
||
it('should generate html response by streaming correctly', async () => { | ||
const html = await renderViaHTTP(next.url, '/') | ||
expect(html).toContain('static streaming') | ||
}) | ||
}) |