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 Juan José Arboleda committed 2022-10-11 14:45:09 -05:00
1 parent 76e9cf2a46
commit bfdee2597a
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'