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
2022-07-31 14:53:06 +03:00
committed by GitHub
parent 4c49632210
commit 5ec2d7bc5d
3 changed files with 3 additions and 2 deletions

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];

View File

@@ -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'));

View File

@@ -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'