From d521d25c74d09c9e68ef2f7a322ebdd2fb5f7571 Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Sun, 10 Jul 2022 14:14:22 +0300 Subject: [PATCH 1/2] test_runner: fix `it` concurrency --- lib/internal/test_runner/test.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index 2ecebde20ce34b..2e1ea1d7a3da5b 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -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 { @@ -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(); } From 5eccc6b6b1b6cf987fcd128c6fed077b30d1b978 Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Sun, 10 Jul 2022 17:13:21 +0300 Subject: [PATCH 2/2] fix --- test/message/test_runner_describe_it.out | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/test/message/test_runner_describe_it.out b/test/message/test_runner_describe_it.out index 278d542fca2c7d..4913038dbb4db9 100644 --- a/test/message/test_runner_describe_it.out +++ b/test/message/test_runner_describe_it.out @@ -188,6 +188,10 @@ ok 20 - immediate resolve pass * * * + * + * + * + * ... 1..1 not ok 21 - subtest sync throw fail @@ -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 @@ -486,6 +493,10 @@ not ok 53 - custom inspect symbol that throws fail * * * + * + * + * + * ... 1..2 not ok 54 - subtest sync throw fails @@ -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