Skip to content

Commit

Permalink
test_runner: display skipped tests in spec reporter output
Browse files Browse the repository at this point in the history
  • Loading branch information
richiemccoll committed Feb 14, 2023
1 parent f46515c commit 188f7bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
5 changes: 3 additions & 2 deletions lib/internal/test_runner/reporter/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,12 @@ class SpecReporter extends Transform {
ArrayPrototypeUnshift(this.#reported, msg);
prefix += `${this.#indent(msg.nesting)}${symbols['arrow:right']}${msg.name}\n`;
}
const skippedSubtest = subtest && data.skip && data.skip !== undefined;
const indent = this.#indent(data.nesting);
const duration_ms = data.details?.duration_ms ? ` ${gray}(${data.details.duration_ms}ms)${white}` : '';
const title = `${data.name}${duration_ms}`;
const title = `${data.name}${duration_ms}${skippedSubtest ? ' # SKIP' : ''}`;
if (this.#reported[0] && this.#reported[0].nesting === data.nesting && this.#reported[0].name === data.name) {
// If this test has had children - it was already reporter, so slightly modify the output
// If this test has had children - it was already reported, so slightly modify the output
ArrayPrototypeShift(this.#reported);
return `${prefix}${indent}${color}${symbols['arrow:right']}${white}${title}\n\n`;
}
Expand Down
20 changes: 10 additions & 10 deletions test/message/test_runner_output_spec_reporter.out
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
*
*

sync skip pass (*ms)
sync skip pass with message (*ms)
sync skip pass (*ms) # SKIP
sync skip pass with message (*ms) # SKIP
sync pass (*ms)
this test should pass
sync throw fail (*ms)
Expand All @@ -34,7 +34,7 @@
*
*

async skip pass (*ms)
async skip pass (*ms) # SKIP
async pass (*ms)
async throw fail (*ms)
Error: thrown from async throw fail
Expand All @@ -46,7 +46,7 @@
*
*

async skip fail (*ms)
async skip fail (*ms) # SKIP
Error: thrown from async throw fail
*
*
Expand Down Expand Up @@ -129,8 +129,8 @@
top level (*ms)

invalid subtest - pass but subtest fails (*ms)
sync skip option (*ms)
sync skip option with message (*ms)
sync skip option (*ms) # SKIP
sync skip option with message (*ms) # SKIP
sync skip option is false fail (*ms)
Error: this should be executed
*
Expand All @@ -146,13 +146,13 @@
<anonymous> (*ms)
test with only a name provided (*ms)
<anonymous> (*ms)
<anonymous> (*ms)
test with a name and options provided (*ms)
functionAndOptions (*ms)
<anonymous> (*ms) # SKIP
test with a name and options provided (*ms) # SKIP
functionAndOptions (*ms) # SKIP
escaped description \ # *
*
(*ms)
escaped skip message (*ms)
escaped skip message (*ms) # SKIP
escaped todo message (*ms)
escaped diagnostic (*ms)
#diagnostic
Expand Down

0 comments on commit 188f7bb

Please sign in to comment.