diff --git a/lib/Server.js b/lib/Server.js index 0c093b2415..79e6fc7910 100644 --- a/lib/Server.js +++ b/lib/Server.js @@ -2955,7 +2955,9 @@ class Server { if (/** @type {NormalizedOpen[]} */ (this.options.open).length > 0) { const openTarget = prettyPrintURL( - !this.options.host || this.options.host === "0.0.0.0" + !this.options.host || + this.options.host === "0.0.0.0" || + this.options.host === "::" ? "localhost" : this.options.host ); diff --git a/test/server/open-option.test.js b/test/server/open-option.test.js index 5a624b00bb..13c4131d3e 100644 --- a/test/server/open-option.test.js +++ b/test/server/open-option.test.js @@ -134,7 +134,7 @@ describe('"open" option', () => { await server.start(); await server.stop(); - expect(open).toHaveBeenCalledWith(`http://[${host}]:${port}/`, { + expect(open).toHaveBeenCalledWith(`http://localhost:${port}/`, { wait: false, }); });