There was an error while loading. Please reload this page.
1 parent b7a42ec commit 7ed5570Copy full SHA for 7ed5570
1 file changed
tests/helpers.ts
@@ -96,6 +96,8 @@ export async function startFixtureServer(
96
holdUntilCrawlEnd: true,
97
},
98
server: {
99
+ // Avoid localhost resolving to ::1 when the test server is bound to IPv4.
100
+ host: "127.0.0.1",
101
port: 0,
102
cors: false,
103
...opts?.server,
@@ -108,7 +110,8 @@ export async function startFixtureServer(
108
110
await server.listen();
109
111
const addr = server.httpServer?.address();
112
if (addr && typeof addr === "object") {
- baseUrl = `http://localhost:${addr.port}`;
113
+ const host = addr.family === "IPv6" ? `[${addr.address}]` : addr.address;
114
+ baseUrl = `http://${host}:${addr.port}`;
115
}
116
117
0 commit comments