Skip to content

Commit

Permalink
test_runner: empty pending tests queue post running
Browse files Browse the repository at this point in the history
PR-URL: #44059
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
  • Loading branch information
MoLow authored and danielleadams committed Aug 11, 2022
1 parent a6c6e88 commit 45f580f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];

Expand Down
2 changes: 1 addition & 1 deletion test/message/test_runner_unresolved_promise.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
2 changes: 1 addition & 1 deletion test/message/test_runner_unresolved_promise.out
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 45f580f

Please sign in to comment.