From 2f02171b589e19aaf427f9a1ea2efda719ef11b7 Mon Sep 17 00:00:00 2001 From: Moshe Atlow Date: Sun, 31 Jul 2022 14:53:06 +0300 Subject: [PATCH] fix: empty pending tests queue post running PR-URL: https://github.com/nodejs/node/pull/44059 Reviewed-By: Antoine du Hamel Reviewed-By: Benjamin Gruenbaum (cherry picked from commit 5ec2d7bc5deed26ac640feff279800e39dacc9c0) --- lib/internal/test_runner/test.js | 3 ++- test/message/test_runner_unresolved_promise.js | 4 ++-- test/message/test_runner_unresolved_promise.out | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/internal/test_runner/test.js b/lib/internal/test_runner/test.js index b504105..9b8ce59 100644 --- a/lib/internal/test_runner/test.js +++ b/lib/internal/test_runner/test.js @@ -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' @@ -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] diff --git a/test/message/test_runner_unresolved_promise.js b/test/message/test_runner_unresolved_promise.js index 03b62a1..842ec5b 100644 --- a/test/message/test_runner_unresolved_promise.js +++ b/test/message/test_runner_unresolved_promise.js @@ -1,4 +1,4 @@ -// 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') @@ -6,4 +6,4 @@ const test = require('#node:test') test('pass') test('never resolving promise', () => new Promise(() => {})) -test('fail') +test('fail', () => console.log('this should not appear')) diff --git a/test/message/test_runner_unresolved_promise.out b/test/message/test_runner_unresolved_promise.out index d4e868c..2bb543c 100644 --- a/test/message/test_runner_unresolved_promise.out +++ b/test/message/test_runner_unresolved_promise.out @@ -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'