mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This adds an `--experimental-https` flag to `next dev` which will generate a self-signed certificate via [mkcert](https://github.com/FiloSottile/mkcert) and use it for the dev server. also supports passing in pre-existing certs via `--experimental-https-cert` and `--experimental-https-key` x-ref: https://github.com/vercel/next.js/discussions/33768 https://github.com/vercel/next.js/discussions/10935
30 lines
996 B
TypeScript
30 lines
996 B
TypeScript
import { createNextDescribe } from 'e2e-utils'
|
|
import https from 'https'
|
|
import { renderViaHTTP } from 'next-test-utils'
|
|
|
|
createNextDescribe(
|
|
'experimental-https-server (provided certificate)',
|
|
{
|
|
files: __dirname,
|
|
startCommand:
|
|
'yarn next dev --experimental-https --experimental-https-key ./certificates/localhost-key.pem --experimental-https-cert ./certificates/localhost.pem',
|
|
},
|
|
({ next }) => {
|
|
const agent = new https.Agent({
|
|
rejectUnauthorized: false,
|
|
})
|
|
|
|
it('should successfully load the app in app dir', async () => {
|
|
expect(next.url).toInclude('https://')
|
|
const html = await renderViaHTTP(next.url, '/1', undefined, { agent })
|
|
expect(html).toContain('Hello from App')
|
|
})
|
|
|
|
it('should successfully load the app in pages dir', async () => {
|
|
expect(next.url).toInclude('https://')
|
|
const html = await renderViaHTTP(next.url, '/2', undefined, { agent })
|
|
expect(html).toContain('Hello from Pages')
|
|
})
|
|
}
|
|
)
|