Unverified Commit 0ec02b0c authored by Hendrik Liebau's avatar Hendrik Liebau Committed by GitHub

Add support for IPv6 in tests (#66285)

Using the hostname `::` enables dual-stack support. This prevents
`ECONNREFUSED` errors when running tests locally, and `localhost` being
resolved to `::1` (IPv6) instead of `127.0.0.1` (IPv4).
parent 0c7c4958
...@@ -34,7 +34,7 @@ async function main() { ...@@ -34,7 +34,7 @@ async function main() {
process.exit(1) process.exit(1)
}) })
server.listen(port, '0.0.0.0', () => { server.listen(port, '::', () => {
console.log(`- Local: http://localhost:${port}`) console.log(`- Local: http://localhost:${port}`)
console.log(`- Next mode: ${dev ? 'development' : process.env.NODE_ENV}`) console.log(`- Next mode: ${dev ? 'development' : process.env.NODE_ENV}`)
}) })
......
...@@ -52,7 +52,7 @@ export function initNextServerScript( ...@@ -52,7 +52,7 @@ export function initNextServerScript(
'node', 'node',
[...((opts && opts.nodeArgs) || []), '--no-deprecation', scriptPath], [...((opts && opts.nodeArgs) || []), '--no-deprecation', scriptPath],
{ {
env, env: { HOSTNAME: '::', ...env },
cwd: opts && opts.cwd, cwd: opts && opts.cwd,
} }
) )
...@@ -434,12 +434,11 @@ export function launchApp( ...@@ -434,12 +434,11 @@ export function launchApp(
dir, dir,
'-p', '-p',
port as string, port as string,
'--hostname',
'::',
].filter(Boolean), ].filter(Boolean),
undefined, undefined,
{ { ...options, turbo: useTurbo }
...options,
turbo: useTurbo,
}
) )
} }
...@@ -484,10 +483,11 @@ export function nextStart( ...@@ -484,10 +483,11 @@ export function nextStart(
port: string | number, port: string | number,
opts: NextDevOptions = {} opts: NextDevOptions = {}
) { ) {
return runNextCommandDev(['start', '-p', port as string, dir], undefined, { return runNextCommandDev(
...opts, ['start', '-p', port as string, '--hostname', '::', dir],
nextStart: true, undefined,
}) { ...opts, nextStart: true }
)
} }
export function buildTS( export function buildTS(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment