test_runner: fix global after not failing the tests

PR-URL: https://github.com/nodejs/node/pull/48913
Backport-PR-URL: https://github.com/nodejs/node/pull/49225
Fixes: https://github.com/nodejs/node/issues/48867
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
Raz Luvaton authored and Ulises Gascón committed 2023-09-10 18:03:28 +00:00
1 parent 08738b2664
commit 4bc0a8fe99
6 files changed
+103 -34

No files matched your search

+8
View File
@@ -688,6 +688,14 @@ class Test extends AsyncResource {
this.parent.processReadySubtestRange(false);
this.parent.processPendingSubtests();
} else if (!this.reported) {
if (!this.passed && failed === 0 && this.error) {
this.reporter.fail(0, kFilename, this.subtests.length + 1, kFilename, {
__proto__: null,
duration_ms: this.#duration(),
error: this.error,
}, undefined);
}
this.reported = true;
this.reporter.plan(this.nesting, kFilename, this.root.harness.counters.topLevel);