Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_runner: fix it concurrency #43757

Merged
merged 2 commits into from
Jul 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
'use strict';
const {
ArrayPrototypePush,
ArrayPrototypeReduce,
ArrayPrototypeShift,
ArrayPrototypeUnshift,
FunctionPrototype,
Number,
PromiseResolve,
ReflectApply,
SafeMap,
PromiseRace,
SafePromiseAll,
} = primordials;
const { AsyncResource } = require('async_hooks');
const {
Expand Down Expand Up @@ -506,10 +505,7 @@ class Suite extends Test {
this.parent.activeSubtests++;
this.startTime = hrtime();
const subtests = this.skipped || this.error ? [] : this.subtests;
await testTimeout(ArrayPrototypeReduce(subtests, async (prev, subtest) => {
await prev;
await subtest.run();
}, PromiseResolve()), this.timeout);
await SafePromiseAll(subtests, (subtests) => subtests.start());
this.pass();
this.postRun();
}
Expand Down
13 changes: 13 additions & 0 deletions test/message/test_runner_describe_it.out
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ ok 20 - immediate resolve pass
*
*
*
*
*
*
*
...
1..1
not ok 21 - subtest sync throw fail
Expand Down Expand Up @@ -471,6 +475,9 @@ not ok 53 - custom inspect symbol that throws fail
*
*
*
*
*
*
...
# Subtest: sync throw fails at second
not ok 2 - sync throw fails at second
Expand All @@ -486,6 +493,10 @@ not ok 53 - custom inspect symbol that throws fail
*
*
*
*
*
*
*
...
1..2
not ok 54 - subtest sync throw fails
Expand Down Expand Up @@ -559,6 +570,8 @@ not ok 56 - describe async throw fails
failureType: 'testTimeoutFailure'
error: 'test timed out after 5ms'
code: 'ERR_TEST_FAILURE'
stack: |-
*
...
# Subtest: timed out callback test
not ok 2 - timed out callback test
Expand Down