test_runner: avoid reporting parents of failing tests in summary

PR-URL: https://github.com/nodejs/node/pull/47579
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
Moshe Atlow authored and GitHub committed 2023-04-18 07:36:56 +00:00
1 parent 682256c76d
commit d3b0a2a68b
4 files changed
+4 -25

No files matched your search

+4 -1
View File
@@ -15,6 +15,7 @@ const assert = require('assert');
const Transform = require('internal/streams/transform');
const { inspectWithNoCustomRetry } = require('internal/errors');
const { green, blue, red, white, gray, hasColors } = require('internal/util/colors');
const { kSubtestsFailed } = require('internal/test_runner/test');
const { getCoverageReport } = require('internal/test_runner/utils');
const inspectOptions = { __proto__: null, colors: hasColors, breakLength: Infinity };
@@ -107,7 +108,9 @@ class SpecReporter extends Transform {
#handleEvent({ type, data }) {
switch (type) {
case 'test:fail':
ArrayPrototypePush(this.#failedTests, data);
if (data.details?.error?.failureType !== kSubtestsFailed) {
ArrayPrototypePush(this.#failedTests, data);
}
return this.#handleTestReportEvent(type, data);
case 'test:pass':
return this.#handleTestReportEvent(type, data);
@@ -399,18 +399,12 @@
*
*
subtest sync throw fail (*ms)
'1 subtest failed'
sync throw non-error fail (*ms)
Symbol(thrown symbol from sync throw non-error fail)
+long running (*ms)
'test did not finish before its parent and was cancelled'
top level (*ms)
'1 subtest failed'
sync skip option is false fail (*ms)
Error: this should be executed
*
@@ -487,9 +481,6 @@
*
*
subtest sync throw fails (*ms)
'2 subtests failed'
timed out async test (*ms)
'test timed out after *ms'
@@ -408,10 +408,6 @@
*
*
subtest sync throw fail (*ms)
[Error: 1 subtest failed
]
sync throw non-error fail (*ms)
[Error: Symbol(thrown symbol from sync throw non-error fail)
]
@@ -420,10 +416,6 @@
[Error: test did not finish before its parent and was cancelled
]
top level (*ms)
[Error: 1 subtest failed
]
sync skip option is false fail (*ms)
Error: this should be executed
*
@@ -504,10 +496,6 @@
*
*
subtest sync throw fails (*ms)
[Error: 2 subtests failed
]
timed out async test (*ms)
[Error: test timed out after *ms
]
@@ -55,6 +55,3 @@
[31m* should pass but parent fail [90m(*ms)[39m[39m
[32m'test did not finish before its parent and was cancelled'[39m
[31m* parent [90m(*ms)[39m[39m
[32m'2 subtests failed'[39m