Skip to content

Commit

Permalink
fix: replace :: with localhost before openBrowser()
Browse files Browse the repository at this point in the history
  • Loading branch information
chousheng committed May 9, 2023
1 parent 99f66cb commit ac971bd
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 === "::"

Check warning on line 2960 in lib/Server.js

View check run for this annotation

Codecov / codecov/patch

lib/Server.js#L2958-L2960

Added lines #L2958 - L2960 were not covered by tests
? "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 ac971bd

Please sign in to comment.