Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test_runner: make more straightforward, nix more dead code
1. formatTestReport: hasChildren arg is unused
2. consider that the existing calls to formatTestReport break down into
   two types:
    - print a line in the test result tree without error details (spec)
    - print error details (spec and dot)

   i.e. whether or not to showErrorDetails.
  • Loading branch information
vassudanagunta committed Sep 3, 2025
commit 44ccad87f4d229a2cf3755affae1dc5e3fbbfba9
9 changes: 2 additions & 7 deletions lib/internal/test_runner/reporter/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class SpecReporter extends Transform {
}

this.#failedTests = []; // Clean up the failed tests
return ArrayPrototypeJoin(results, '\n'); ;
return ArrayPrototypeJoin(results, '\n');
}
#handleTestReportEvent(type, data) {
const subtest = ArrayPrototypeShift(this.#stack); // This is the matching `test:start` event
Expand All @@ -71,13 +71,8 @@ class SpecReporter extends Transform {
ArrayPrototypeUnshift(this.#reported, msg);
prefix += `${indent(msg.nesting)}${reporterUnicodeSymbolMap['arrow:right']}${msg.name}\n`;
}
let hasChildren = false;
if (this.#reported[0] && this.#reported[0].nesting === data.nesting && this.#reported[0].name === data.name) {
ArrayPrototypeShift(this.#reported);
hasChildren = true;
}
const indentation = indent(data.nesting);
return `${formatTestReport(type, data, prefix, indentation, hasChildren, false)}\n`;
return `${formatTestReport(type, data, false, prefix, indentation)}\n`;
}
#handleEvent({ type, data }) {
switch (type) {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/test_runner/reporter/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ function formatError(error, indent) {
return `\n${indent} ${message}\n`;
}

function formatTestReport(type, data, prefix = '', indent = '', hasChildren = false, showErrorDetails = true) {
function formatTestReport(type, data, showErrorDetails = true, prefix = '', indent = '') {
let color = reporterColorMap[type] ?? colors.white;
let symbol = reporterUnicodeSymbolMap[type] ?? ' ';
const { skip, todo } = data;
Expand Down