mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
add experimental https support to next dev (#54016)
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
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
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')
|
||||
})
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user