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 66016e2

Browse filesBrowse files
richiemccolltargos
authored andcommitted
test_runner: display skipped tests in spec reporter output
PR-URL: #46651 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
1 parent 75e4325 commit 66016e2
Copy full SHA for 66016e2

File tree

Expand file treeCollapse file tree

2 files changed

+20
-14
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+20
-14
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
+10-4Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ const symbols = {
3030
'test:pass': '\u2714 ',
3131
'test:diagnostic': '\u2139 ',
3232
'arrow:right': '\u25B6 ',
33+
'hyphen:minus': '\uFE63 ',
3334
};
3435
class SpecReporter extends Transform {
3536
#stack = [];
@@ -60,8 +61,8 @@ class SpecReporter extends Transform {
6061
return `\n${indent} ${message}\n`;
6162
}
6263
#handleEvent({ type, data }) {
63-
const color = colors[type] ?? white;
64-
const symbol = symbols[type] ?? ' ';
64+
let color = colors[type] ?? white;
65+
let symbol = symbols[type] ?? ' ';
6566

6667
switch (type) {
6768
case 'test:fail':
@@ -81,15 +82,20 @@ class SpecReporter extends Transform {
8182
ArrayPrototypeUnshift(this.#reported, msg);
8283
prefix += `${this.#indent(msg.nesting)}${symbols['arrow:right']}${msg.name}\n`;
8384
}
85+
const skippedSubtest = subtest && data.skip && data.skip !== undefined;
8486
const indent = this.#indent(data.nesting);
8587
const duration_ms = data.details?.duration_ms ? ` ${gray}(${data.details.duration_ms}ms)${white}` : '';
86-
const title = `${data.name}${duration_ms}`;
88+
const title = `${data.name}${duration_ms}${skippedSubtest ? ' # SKIP' : ''}`;
8789
if (this.#reported[0] && this.#reported[0].nesting === data.nesting && this.#reported[0].name === data.name) {
88-
// If this test has had children - it was already reporter, so slightly modify the output
90+
// If this test has had children - it was already reported, so slightly modify the output
8991
ArrayPrototypeShift(this.#reported);
9092
return `${prefix}${indent}${color}${symbols['arrow:right']}${white}${title}\n\n`;
9193
}
9294
const error = this.#formatError(data.details?.error, indent);
95+
if (skippedSubtest) {
96+
color = gray;
97+
symbol = symbols['hyphen:minus'];
98+
}
9399
return `${prefix}${indent}${color}${symbol}${title}${error}${white}\n`;
94100
}
95101
case 'test:start':
Collapse file

‎test/message/test_runner_output_spec_reporter.out‎

Copy file name to clipboardExpand all lines: test/message/test_runner_output_spec_reporter.out
+10-10Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
*
2121
*
2222

23-
sync skip pass (*ms)
24-
sync skip pass with message (*ms)
23+
sync skip pass (*ms) # SKIP
24+
sync skip pass with message (*ms) # SKIP
2525
sync pass (*ms)
2626
this test should pass
2727
sync throw fail (*ms)
@@ -34,7 +34,7 @@
3434
*
3535
*
3636

37-
async skip pass (*ms)
37+
async skip pass (*ms) # SKIP
3838
async pass (*ms)
3939
async throw fail (*ms)
4040
Error: thrown from async throw fail
@@ -46,7 +46,7 @@
4646
*
4747
*
4848

49-
async skip fail (*ms)
49+
async skip fail (*ms) # SKIP
5050
Error: thrown from async throw fail
5151
*
5252
*
@@ -129,8 +129,8 @@
129129
top level (*ms)
130130

131131
invalid subtest - pass but subtest fails (*ms)
132-
sync skip option (*ms)
133-
sync skip option with message (*ms)
132+
sync skip option (*ms) # SKIP
133+
sync skip option with message (*ms) # SKIP
134134
sync skip option is false fail (*ms)
135135
Error: this should be executed
136136
*
@@ -146,13 +146,13 @@
146146
<anonymous> (*ms)
147147
test with only a name provided (*ms)
148148
<anonymous> (*ms)
149-
<anonymous> (*ms)
150-
test with a name and options provided (*ms)
151-
functionAndOptions (*ms)
149+
<anonymous> (*ms) # SKIP
150+
test with a name and options provided (*ms) # SKIP
151+
functionAndOptions (*ms) # SKIP
152152
escaped description \ # *
153153
*
154154
(*ms)
155-
escaped skip message (*ms)
155+
escaped skip message (*ms) # SKIP
156156
escaped todo message (*ms)
157157
escaped diagnostic (*ms)
158158
#diagnostic

0 commit comments

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