@@ -68,7 +68,9 @@ describe('basic', () => {
6868 path . resolve (
6969 __dirname ,
7070 '../fixtures/promise-config/webpack.config.js'
71- )
71+ ) ,
72+ '--port' ,
73+ port
7274 ) ;
7375 expect ( exitCode ) . toEqual ( 0 ) ;
7476 } catch ( err ) {
@@ -86,7 +88,7 @@ describe('basic', () => {
8688 __dirname ,
8789 '../../examples/cli/web-socket-url'
8890 ) ;
89- const cp = execa ( 'node' , [ cliPath ] , { cwd : examplePath } ) ;
91+ const cp = execa ( 'node' , [ cliPath , '--port' , port ] , { cwd : examplePath } ) ;
9092
9193 cp . stdout . on ( 'data' , ( data ) => {
9294 const bits = data . toString ( ) ;
@@ -109,7 +111,7 @@ describe('basic', () => {
109111 '../../bin/webpack-dev-server.js'
110112 ) ;
111113 const cwd = path . resolve ( __dirname , '../fixtures/cli' ) ;
112- const cp = execa ( 'node' , [ cliPath ] , { cwd } ) ;
114+ const cp = execa ( 'node' , [ cliPath , '--port' , port ] , { cwd } ) ;
113115
114116 let killed = false ;
115117
@@ -137,9 +139,13 @@ describe('basic', () => {
137139 __dirname ,
138140 '../../examples/cli/web-socket-url'
139141 ) ;
140- const cp = execa ( 'node' , [ cliPath , '--watch-options-stdin' ] , {
141- cwd : examplePath ,
142- } ) ;
142+ const cp = execa (
143+ 'node' ,
144+ [ cliPath , '--watch-options-stdin' , '--port' , port ] ,
145+ {
146+ cwd : examplePath ,
147+ }
148+ ) ;
143149
144150 cp . stdout . on ( 'data' , ( data ) => {
145151 const bits = data . toString ( ) ;
@@ -163,7 +169,11 @@ describe('basic', () => {
163169 '../../bin/webpack-dev-server.js'
164170 ) ;
165171 const cwd = path . resolve ( __dirname , '../fixtures/cli' ) ;
166- const cp = execa ( 'node' , [ cliPath , '--watch-options-stdin' ] , { cwd } ) ;
172+ const cp = execa (
173+ 'node' ,
174+ [ cliPath , '--watch-options-stdin' , '--port' , port ] ,
175+ { cwd }
176+ ) ;
167177
168178 let killed = false ;
169179
@@ -186,7 +196,9 @@ describe('basic', () => {
186196 it ( 'should add dev server entry points to a single entry point' , async ( ) => {
187197 const { exitCode, stdout } = await testBin (
188198 null ,
189- './test/fixtures/dev-server/default-config.js'
199+ './test/fixtures/dev-server/default-config.js' ,
200+ '--port' ,
201+ port
190202 ) ;
191203
192204 expect ( exitCode ) . toEqual ( 0 ) ;
@@ -198,7 +210,9 @@ describe('basic', () => {
198210 async ( ) => {
199211 const { exitCode, stdout } = await testBin (
200212 '--stats=verbose' ,
201- './test/fixtures/dev-server/multi-entry.js'
213+ './test/fixtures/dev-server/multi-entry.js' ,
214+ '--port' ,
215+ port
202216 ) ;
203217
204218 expect ( exitCode ) . toEqual ( 0 ) ;
@@ -212,7 +226,9 @@ describe('basic', () => {
212226 async ( ) => {
213227 const { exitCode, stdout } = await testBin (
214228 null ,
215- './test/fixtures/dev-server/empty-entry.js'
229+ './test/fixtures/dev-server/empty-entry.js' ,
230+ '--port' ,
231+ port
216232 ) ;
217233
218234 expect ( exitCode ) . toEqual ( 0 ) ;
@@ -223,7 +239,9 @@ describe('basic', () => {
223239 webpack5Test ( 'should supports entry as descriptor' , async ( ) => {
224240 const { exitCode, stdout } = await testBin (
225241 '--stats=detailed' ,
226- './test/fixtures/entry-as-descriptor/webpack.config'
242+ './test/fixtures/entry-as-descriptor/webpack.config' ,
243+ '--port' ,
244+ port
227245 ) ;
228246
229247 expect ( exitCode ) . toEqual ( 0 ) ;
@@ -233,7 +251,9 @@ describe('basic', () => {
233251 it ( 'should only prepends dev server entry points to "web" target' , async ( ) => {
234252 const { exitCode, stdout } = await testBin (
235253 '--target web' ,
236- './test/fixtures/dev-server/default-config.js'
254+ './test/fixtures/dev-server/default-config.js' ,
255+ '--port' ,
256+ port
237257 ) ;
238258
239259 expect ( exitCode ) . toEqual ( 0 ) ;
@@ -244,7 +264,9 @@ describe('basic', () => {
244264 it ( 'should not prepend dev server entry points to "node" target' , async ( ) => {
245265 const { exitCode, stdout } = await testBin (
246266 '--target node' ,
247- './test/fixtures/dev-server/default-config.js'
267+ './test/fixtures/dev-server/default-config.js' ,
268+ '--port' ,
269+ port
248270 ) ;
249271
250272 expect ( exitCode ) . toEqual ( 0 ) ;
@@ -255,7 +277,9 @@ describe('basic', () => {
255277 it ( 'should prepends the hot runtime to "node" target as well' , async ( ) => {
256278 const { exitCode, stdout } = await testBin (
257279 '--target node --hot' ,
258- './test/fixtures/dev-server/default-config.js'
280+ './test/fixtures/dev-server/default-config.js' ,
281+ '--port' ,
282+ port
259283 ) ;
260284
261285 expect ( exitCode ) . toEqual ( 0 ) ;
@@ -267,7 +291,9 @@ describe('basic', () => {
267291 async ( ) => {
268292 const { exitCode, stdout } = await testBin (
269293 null ,
270- './test/fixtures/dev-server/target-config.js'
294+ './test/fixtures/dev-server/target-config.js' ,
295+ '--port' ,
296+ port
271297 ) ;
272298
273299 expect ( exitCode ) . toEqual ( 0 ) ;
0 commit comments