File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -258,6 +258,8 @@ describe('test runner watch mode', () => {
258
258
} ) ;
259
259
260
260
it ( 'should emits test:watch:restarted when file is updated' , async ( ) => {
261
+ let alreadyDrained = false ;
262
+ const events = [ ] ;
261
263
const testWatchRestarted = common . mustCall ( 1 ) ;
262
264
263
265
const controller = new AbortController ( ) ;
@@ -266,9 +268,15 @@ describe('test runner watch mode', () => {
266
268
watch : true ,
267
269
signal : controller . signal ,
268
270
} ) . on ( 'data' , function ( { type } ) {
271
+ events . push ( type ) ;
269
272
if ( type === 'test:watch:restarted' ) {
270
273
testWatchRestarted ( ) ;
271
- controller . abort ( ) ;
274
+ }
275
+ if ( type === 'test:watch:drained' ) {
276
+ if ( alreadyDrained ) {
277
+ controller . abort ( ) ;
278
+ }
279
+ alreadyDrained = true ;
272
280
}
273
281
} ) ;
274
282
@@ -278,6 +286,12 @@ describe('test runner watch mode', () => {
278
286
279
287
// eslint-disable-next-line no-unused-vars
280
288
for await ( const _ of stream ) ;
289
+
290
+ assert . partialDeepStrictEqual ( events , [
291
+ 'test:watch:drained' ,
292
+ 'test:watch:restarted' ,
293
+ 'test:watch:drained' ,
294
+ ] ) ;
281
295
} ) ;
282
296
283
297
it ( 'should not emit test:watch:restarted since watch mode is disabled' , async ( ) => {
You can’t perform that action at this time.
0 commit comments