Skip to content

Commit

Permalink
fix: empty pending tests queue post running
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node#44059
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
(cherry picked from commit 5ec2d7bc5deed26ac640feff279800e39dacc9c0)
(cherry picked from commit 8b5a214)
  • Loading branch information
MoLow committed Jul 31, 2022
1 parent 4ed5d1f commit 05c69cb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/internal/test_runner/test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// https://github.com/nodejs/node/blob/659dc126932f986fc33c7f1c878cb2b57a1e2fac/lib/internal/test_runner/test.js
// https://github.com/nodejs/node/blob/5ec2d7bc5deed26ac640feff279800e39dacc9c0/lib/internal/test_runner/test.js

'use strict'

Expand Down Expand Up @@ -525,6 +525,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
4 changes: 2 additions & 2 deletions test/message/test_runner_unresolved_promise.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// https://github.com/nodejs/node/blob/1aab13cad9c800f4121c1d35b554b78c1b17bdbd/test/message/test_runner_unresolved_promise.js
// https://github.com/nodejs/node/blob/5ec2d7bc5deed26ac640feff279800e39dacc9c0/test/message/test_runner_unresolved_promise.js
// Flags: --no-warnings
'use strict'
require('../common')
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 05c69cb

Please sign in to comment.