Skip to content

Commit 0d00747

Browse files
MoLowruyadorno
authored andcommitted
test_runner: empty pending tests queue post running
PR-URL: #44059 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
1 parent 1d6029a commit 0d00747

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

lib/internal/test_runner/test.js

+1
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,7 @@ class Test extends AsyncResource {
523523

524524
// The test has run, so recursively cancel any outstanding subtests and
525525
// mark this test as failed if any subtests failed.
526+
this.pendingSubtests = [];
526527
for (let i = 0; i < this.subtests.length; i++) {
527528
const subtest = this.subtests[i];
528529

test/message/test_runner_unresolved_promise.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ const test = require('node:test');
55

66
test('pass');
77
test('never resolving promise', () => new Promise(() => {}));
8-
test('fail');
8+
test('fail', () => console.log('this should not appear'));

test/message/test_runner_unresolved_promise.out

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ not ok 2 - never resolving promise
1717
# Subtest: fail
1818
not ok 3 - fail
1919
---
20-
duration_ms: *
20+
duration_ms: 0
2121
failureType: 'cancelledByParent'
2222
error: 'test did not finish before its parent and was cancelled'
2323
code: 'ERR_TEST_FAILURE'

0 commit comments

Comments
 (0)