Skip to content

Commit

Permalink
test_runner: use test: symbol on second print of parent test
Browse files Browse the repository at this point in the history
PR-URL: #54956
Reviewed-By: Moshe Atlow <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
avivkeller authored and marco-ippolito committed Nov 16, 2024
1 parent 0df824b commit 276c2e1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions lib/internal/test_runner/reporter/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,14 @@ function formatTestReport(type, data, prefix = '', indent = '', hasChildren = fa
title += ` # ${typeof todo === 'string' && todo.length ? todo : 'TODO'}`;
}
const error = formatError(data.details?.error, indent);
if (hasChildren) {
// If this test has had children - it was already reported, so slightly modify the output
const err = !error || data.details?.error?.failureType === 'subtestsFailed' ? '' : `\n${error}`;
return `${prefix}${indent}${color}${reporterUnicodeSymbolMap['arrow:right']}${colors.white}${title}${err}`;
}
const err = hasChildren ?
(!error || data.details?.error?.failureType === 'subtestsFailed' ? '' : `\n${error}`) :
error;
if (skip !== undefined) {
color = colors.gray;
symbol = reporterUnicodeSymbolMap['hyphen:minus'];
}
return `${prefix}${indent}${color}${symbol}${title}${colors.white}${error}`;
return `${prefix}${indent}${color}${symbol}${title}${colors.white}${err}`;
}

module.exports = {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/test-runner/output/default_output.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
[31m✖ should pass but parent fail [90m(*ms)[39m[39m
[32m'test did not finish before its parent and was cancelled'[39m

[31m▶ [39mparent [90m(*ms)[39m
[31m✖ parent [90m(*ms)[39m[39m
[34mℹ tests 6[39m
[34mℹ suites 0[39m
[34mℹ pass 1[39m
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/test-runner/output/suite-skip-hooks.snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ AFTER 2
✔ should run 1 (*ms)
﹣ should not run (*ms) # SKIP
✔ should run 2 (*ms)
suite runs with mixture of skipped tests (*ms)
suite runs with mixture of skipped tests (*ms)
ℹ tests 4
ℹ suites 2
ℹ pass 2
Expand Down

0 comments on commit 276c2e1

Please sign in to comment.