File tree 1 file changed +9
-8
lines changed
1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -387,29 +387,30 @@ test('options.bail will bail out', t => {
387
387
test ( 'options.bail will bail out (async)' , t => {
388
388
t . plan ( 1 ) ;
389
389
390
- const tests = [ ] ;
391
- return promiseEnd ( new Runner ( { bail : true } ) , runner => {
390
+ let bailed = false ;
391
+ promiseEnd ( new Runner ( { bail : true } ) , runner => {
392
392
runner . chain . cb ( 'cb' , a => {
393
393
setTimeout ( ( ) => {
394
- tests . push ( 1 ) ;
395
394
a . fail ( ) ;
396
395
a . end ( ) ;
397
396
} , 100 ) ;
398
397
a . pass ( ) ;
399
398
} ) ;
400
399
400
+ // Note that because the first test is asynchronous, the second test is
401
+ // run and the `setTimeout` call still occurs. The runner should end though
402
+ // as soon as the first test fails.
403
+ // See the `bail + serial` test below for comparison
401
404
runner . chain . cb ( 'cb 2' , a => {
402
405
setTimeout ( ( ) => {
403
- tests . push ( 2 ) ;
406
+ t . true ( bailed ) ;
407
+ t . end ( ) ;
404
408
a . end ( ) ;
405
409
} , 300 ) ;
406
410
a . pass ( ) ;
407
411
} ) ;
408
412
} ) . then ( ( ) => {
409
- t . strictDeepEqual ( tests , [ 1 ] ) ;
410
- // Note that the second `setTimeout` call still occurs, but the test run
411
- // ends as soon as the first test fails.
412
- // See the `bail + serial` test below for comparison
413
+ bailed = true ;
413
414
} ) ;
414
415
} ) ;
415
416
You can’t perform that action at this time.
0 commit comments