test_runner: empty pending tests queue post running

PR-URL: https://github.com/nodejs/node/pull/44059
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
Moshe Atlow authored and Ruy Adorno committed 2022-08-22 19:37:12 -04:00
1 parent 1d6029aa3d
commit 0d007471fa
3 files changed
+3 -2

No files matched your search

+1
View File
@@ -523,6 +523,7 @@ class Test extends AsyncResource {
// The test has run, so recursively cancel any outstanding subtests and
// mark this test as failed if any subtests failed.
this.pendingSubtests = [];
for (let i = 0; i < this.subtests.length; i++) {
const subtest = this.subtests[i];
@@ -5,4 +5,4 @@ const test = require('node:test');
test('pass');
test('never resolving promise', () => new Promise(() => {}));
test('fail');
test('fail', () => console.log('this should not appear'));
@@ -17,7 +17,7 @@ not ok 2 - never resolving promise
# Subtest: fail
not ok 3 - fail
---
duration_ms: *
duration_ms: 0
failureType: 'cancelledByParent'
error: 'test did not finish before its parent and was cancelled'
code: 'ERR_TEST_FAILURE'