File tree 2 files changed +7
-3
lines changed
2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -2893,7 +2893,11 @@ class Server {
2893
2893
}
2894
2894
2895
2895
if ( /** @type {NormalizedOpen[] } */ ( this . options . open ) . length > 0 ) {
2896
- const openTarget = prettyPrintURL ( this . options . host || "localhost" ) ;
2896
+ const openTarget = prettyPrintURL (
2897
+ ! this . options . host || this . options . host === "0.0.0.0"
2898
+ ? "localhost"
2899
+ : this . options . host
2900
+ ) ;
2897
2901
2898
2902
this . openBrowser ( openTarget ) ;
2899
2903
}
Original file line number Diff line number Diff line change @@ -99,7 +99,7 @@ describe('"open" option', () => {
99
99
} ) ;
100
100
} ) ;
101
101
102
- it ( "should work with '0.0.0.0' host" , async ( ) => {
102
+ it ( "should work with '0.0.0.0' host but open localhost " , async ( ) => {
103
103
const host = "0.0.0.0" ;
104
104
105
105
const server = new Server (
@@ -114,7 +114,7 @@ describe('"open" option', () => {
114
114
await server . start ( ) ;
115
115
await server . stop ( ) ;
116
116
117
- expect ( open ) . toHaveBeenCalledWith ( `http://${ host } :${ port } /` , {
117
+ expect ( open ) . toHaveBeenCalledWith ( `http://localhost :${ port } /` , {
118
118
wait : false ,
119
119
} ) ;
120
120
} ) ;
You can’t perform that action at this time.
0 commit comments