Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 4bce391

Browse filesBrowse files
committed
test_runner: avoid reporting parents of failing tests in summary
PR-URL: #47579 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent a67e5ea commit 4bce391
Copy full SHA for 4bce391

File tree

Expand file treeCollapse file tree

4 files changed

+4
-25
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

4 files changed

+4
-25
lines changed
Open diff view settings
Collapse file

‎lib/internal/test_runner/reporter/spec.js‎

Copy file name to clipboardExpand all lines: lib/internal/test_runner/reporter/spec.js
+4-1Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const assert = require('assert');
1515
const Transform = require('internal/streams/transform');
1616
const { inspectWithNoCustomRetry } = require('internal/errors');
1717
const { green, blue, red, white, gray, hasColors } = require('internal/util/colors');
18+
const { kSubtestsFailed } = require('internal/test_runner/test');
1819
const { getCoverageReport } = require('internal/test_runner/utils');
1920

2021
const inspectOptions = { __proto__: null, colors: hasColors, breakLength: Infinity };
@@ -107,7 +108,9 @@ class SpecReporter extends Transform {
107108
#handleEvent({ type, data }) {
108109
switch (type) {
109110
case 'test:fail':
110-
ArrayPrototypePush(this.#failedTests, data);
111+
if (data.details?.error?.failureType !== kSubtestsFailed) {
112+
ArrayPrototypePush(this.#failedTests, data);
113+
}
111114
return this.#handleTestReportEvent(type, data);
112115
case 'test:pass':
113116
return this.#handleTestReportEvent(type, data);
Collapse file

‎test/fixtures/test-runner/output/spec_reporter.snapshot‎

Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/spec_reporter.snapshot
-9Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -399,18 +399,12 @@
399399
*
400400
*
401401

402-
subtest sync throw fail (*ms)
403-
'1 subtest failed'
404-
405402
sync throw non-error fail (*ms)
406403
Symbol(thrown symbol from sync throw non-error fail)
407404

408405
+long running (*ms)
409406
'test did not finish before its parent and was cancelled'
410407

411-
top level (*ms)
412-
'1 subtest failed'
413-
414408
sync skip option is false fail (*ms)
415409
Error: this should be executed
416410
*
@@ -487,9 +481,6 @@
487481
*
488482
*
489483

490-
subtest sync throw fails (*ms)
491-
'2 subtests failed'
492-
493484
timed out async test (*ms)
494485
'test timed out after *ms'
495486

Collapse file

‎test/fixtures/test-runner/output/spec_reporter_cli.snapshot‎

Copy file name to clipboardExpand all lines: test/fixtures/test-runner/output/spec_reporter_cli.snapshot
-12Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -408,10 +408,6 @@
408408
*
409409
*
410410

411-
subtest sync throw fail (*ms)
412-
[Error: 1 subtest failed
413-
]
414-
415411
sync throw non-error fail (*ms)
416412
[Error: Symbol(thrown symbol from sync throw non-error fail)
417413
]
@@ -420,10 +416,6 @@
420416
[Error: test did not finish before its parent and was cancelled
421417
]
422418

423-
top level (*ms)
424-
[Error: 1 subtest failed
425-
]
426-
427419
sync skip option is false fail (*ms)
428420
Error: this should be executed
429421
*
@@ -504,10 +496,6 @@
504496
*
505497
*
506498

507-
subtest sync throw fails (*ms)
508-
[Error: 2 subtests failed
509-
]
510-
511499
timed out async test (*ms)
512500
[Error: test timed out after *ms
513501
]
Collapse file

‎test/pseudo-tty/test_runner_default_reporter.out‎

Copy file name to clipboardExpand all lines: test/pseudo-tty/test_runner_default_reporter.out
-3Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,3 @@
5555

5656
[31m* should pass but parent fail [90m(*ms)[39m[39m
5757
[32m'test did not finish before its parent and was cancelled'[39m
58-
59-
[31m* parent [90m(*ms)[39m[39m
60-
[32m'2 subtests failed'[39m

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.