File tree Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Expand file tree Collapse file tree 2 files changed +20
-8
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
const {
3
+ ArrayPrototypeMap,
3
4
ArrayPrototypePush,
4
- ArrayPrototypeReduce,
5
5
ArrayPrototypeShift,
6
6
ArrayPrototypeUnshift,
7
7
FunctionPrototype,
8
8
Number,
9
- PromiseResolve ,
9
+ PromiseAll ,
10
10
ReflectApply,
11
11
SafeMap,
12
12
} = primordials ;
@@ -457,7 +457,11 @@ class Suite extends Test {
457
457
constructor ( options ) {
458
458
super ( options ) ;
459
459
460
- this . runInAsyncScope ( this . fn ) ;
460
+ try {
461
+ this . runInAsyncScope ( this . fn ) ;
462
+ } catch ( err ) {
463
+ this . fail ( new ERR_TEST_FAILURE ( err , kTestCodeFailure ) ) ;
464
+ }
461
465
this . fn = ( ) => { } ;
462
466
this . finished = true ; // Forbid adding subtests to this suite
463
467
}
@@ -469,11 +473,8 @@ class Suite extends Test {
469
473
async run ( ) {
470
474
this . parent . activeSubtests ++ ;
471
475
this . startTime = hrtime ( ) ;
472
- const subtests = this . skipped ? [ ] : this . subtests ;
473
- await ArrayPrototypeReduce ( subtests , async ( prev , subtest ) => {
474
- await prev ;
475
- await subtest . run ( ) ;
476
- } , PromiseResolve ( ) ) ;
476
+ const subtests = this . skipped || this . error ? [ ] : this . subtests ;
477
+ await PromiseAll ( ArrayPrototypeMap ( subtests , subtests => subtests . start ( ) ) ) ;
477
478
this . pass ( ) ;
478
479
this . postRun ( ) ;
479
480
}
Original file line number Diff line number Diff line change @@ -182,6 +182,10 @@ ok 19 - immediate resolve pass
182
182
*
183
183
*
184
184
*
185
+ *
186
+ *
187
+ *
188
+ *
185
189
...
186
190
1..1
187
191
not ok 20 - subtest sync throw fail
@@ -465,6 +469,9 @@ not ok 52 - custom inspect symbol that throws fail
465
469
*
466
470
*
467
471
*
472
+ *
473
+ *
474
+ *
468
475
...
469
476
# Subtest: sync throw fails at second
470
477
not ok 2 - sync throw fails at second
@@ -480,6 +487,10 @@ not ok 52 - custom inspect symbol that throws fail
480
487
*
481
488
*
482
489
*
490
+ *
491
+ *
492
+ *
493
+ *
483
494
...
484
495
1..2
485
496
not ok 53 - subtest sync throw fails
You can’t perform that action at this time.
0 commit comments