Files
Jiachi LiuandGitHub 70231ef7cd test: add case for marking _document with edge runtime (#54316)
Can't repro anymore, add a test case for issue 45189

Closes #45189
Closes NEXT-1396
2023-08-21 20:56:46 +00:00

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')
})
}
)