mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
Can't repro anymore, add a test case for issue 45189 Closes #45189 Closes NEXT-1396
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { createNextDescribe } from 'e2e-utils'
|
|
import { join } from 'path'
|
|
|
|
// x-ref: https://github.com/vercel/next.js/issues/45189
|
|
createNextDescribe(
|
|
'edge render - custom _document with edge runtime',
|
|
{
|
|
files: join(__dirname, 'app'),
|
|
},
|
|
({ next }) => {
|
|
beforeAll(async () => {
|
|
await next.stop()
|
|
await next.patchFile(
|
|
'pages/_document.js',
|
|
`import Document, { Html, Head, Main, NextScript } from 'next/document'
|
|
|
|
export default class MyDocument extends Document {
|
|
render() {
|
|
return (
|
|
<Html>
|
|
<Head />
|
|
<body>
|
|
<Main />
|
|
<NextScript />
|
|
</body>
|
|
</Html>
|
|
)
|
|
}
|
|
}
|
|
|
|
export const config = {
|
|
runtime: 'experimental-edge',
|
|
}
|
|
`
|
|
)
|
|
await next.start()
|
|
})
|
|
afterAll(async () => {
|
|
await next.deleteFile('pages/_document.js')
|
|
})
|
|
|
|
it('should render page properly', async () => {
|
|
const $ = await next.render$('/')
|
|
expect($('#page').text()).toBe('/index')
|
|
})
|
|
}
|
|
)
|