File tree 2 files changed +29
-2
lines changed
2 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -2175,7 +2175,9 @@ class Server {
2175
2175
}
2176
2176
2177
2177
startCallback ( callback ) {
2178
- this . start ( ) . then ( ( ) => callback ( null ) , callback ) ;
2178
+ this . start ( )
2179
+ . then ( ( ) => callback ( null ) , callback )
2180
+ . catch ( callback ) ;
2179
2181
}
2180
2182
2181
2183
async stop ( ) {
@@ -2235,7 +2237,9 @@ class Server {
2235
2237
}
2236
2238
2237
2239
stopCallback ( callback ) {
2238
- this . stop ( ) . then ( ( ) => callback ( null ) , callback ) ;
2240
+ this . stop ( )
2241
+ . then ( ( ) => callback ( null ) , callback )
2242
+ . catch ( callback ) ;
2239
2243
}
2240
2244
2241
2245
// TODO remove in the next major release
Original file line number Diff line number Diff line change @@ -80,6 +80,29 @@ describe("API", () => {
80
80
} ) ;
81
81
} ) ;
82
82
83
+ it ( `should catch errors within startCallback` , async ( ) => {
84
+ const compiler = webpack ( config ) ;
85
+ const server = new Server (
86
+ { port, static : "https://absolute-url.com/somewhere" } ,
87
+ compiler
88
+ ) ;
89
+
90
+ await new Promise ( ( resolve ) => {
91
+ server . startCallback ( ( err ) => {
92
+ expect ( err . message ) . toEqual (
93
+ "Using a URL as static.directory is not supported"
94
+ ) ;
95
+ resolve ( ) ;
96
+ } ) ;
97
+ } ) ;
98
+
99
+ await new Promise ( ( resolve ) => {
100
+ server . stopCallback ( ( ) => {
101
+ resolve ( ) ;
102
+ } ) ;
103
+ } ) ;
104
+ } ) ;
105
+
83
106
it ( `should work when using configured manually` , async ( ) => {
84
107
const compiler = webpack ( {
85
108
...config ,
You can’t perform that action at this time.
0 commit comments