Skip to content

Commit 9033d28

Browse files
MoLowguangwong
authored andcommitted
test_runner: fix it concurrency
PR-URL: nodejs/node#43757 Reviewed-By: Antoine du Hamel <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Jacob Smith <[email protected]>
1 parent 70b9af9 commit 9033d28

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

lib/internal/test_runner/test.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
'use strict';
22
const {
33
ArrayPrototypePush,
4-
ArrayPrototypeReduce,
54
ArrayPrototypeShift,
65
ArrayPrototypeUnshift,
76
FunctionPrototype,
87
Number,
9-
PromiseResolve,
108
ReflectApply,
119
SafeMap,
1210
PromiseRace,
11+
SafePromiseAll,
1312
} = primordials;
1413
const { AsyncResource } = require('async_hooks');
1514
const {
@@ -506,10 +505,7 @@ class Suite extends Test {
506505
this.parent.activeSubtests++;
507506
this.startTime = hrtime();
508507
const subtests = this.skipped || this.error ? [] : this.subtests;
509-
await testTimeout(ArrayPrototypeReduce(subtests, async (prev, subtest) => {
510-
await prev;
511-
await subtest.run();
512-
}, PromiseResolve()), this.timeout);
508+
await SafePromiseAll(subtests, (subtests) => subtests.start());
513509
this.pass();
514510
this.postRun();
515511
}

test/message/test_runner_desctibe_it.out

+13
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ ok 20 - immediate resolve pass
188188
*
189189
*
190190
*
191+
*
192+
*
193+
*
194+
*
191195
...
192196
1..1
193197
not ok 21 - subtest sync throw fail
@@ -471,6 +475,9 @@ not ok 53 - custom inspect symbol that throws fail
471475
*
472476
*
473477
*
478+
*
479+
*
480+
*
474481
...
475482
# Subtest: sync throw fails at second
476483
not ok 2 - sync throw fails at second
@@ -486,6 +493,10 @@ not ok 53 - custom inspect symbol that throws fail
486493
*
487494
*
488495
*
496+
*
497+
*
498+
*
499+
*
489500
...
490501
1..2
491502
not ok 54 - subtest sync throw fails
@@ -559,6 +570,8 @@ not ok 56 - describe async throw fails
559570
failureType: 'testTimeoutFailure'
560571
error: 'test timed out after 5ms'
561572
code: 'ERR_TEST_FAILURE'
573+
stack: |-
574+
*
562575
...
563576
# Subtest: timed out callback test
564577
not ok 2 - timed out callback test

0 commit comments

Comments
 (0)