Skip to content

Commit

Permalink
fix: replace :: with localhost before openBrowser() (#4856)
Browse files Browse the repository at this point in the history
  • Loading branch information
chousheng authored May 12, 2023
1 parent c54e427 commit 874c44b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
);
Expand Down
2 changes: 1 addition & 1 deletion test/server/open-option.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
});
Expand Down

0 comments on commit 874c44b

Please sign in to comment.