Skip to content

Commit 44ccad8

Browse files
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.
1 parent dac69ea commit 44ccad8

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

lib/internal/test_runner/reporter/spec.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class SpecReporter extends Transform {
5353
}
5454

5555
this.#failedTests = []; // Clean up the failed tests
56-
return ArrayPrototypeJoin(results, '\n'); ;
56+
return ArrayPrototypeJoin(results, '\n');
5757
}
5858
#handleTestReportEvent(type, data) {
5959
const subtest = ArrayPrototypeShift(this.#stack); // This is the matching `test:start` event
@@ -71,13 +71,8 @@ class SpecReporter extends Transform {
7171
ArrayPrototypeUnshift(this.#reported, msg);
7272
prefix += `${indent(msg.nesting)}${reporterUnicodeSymbolMap['arrow:right']}${msg.name}\n`;
7373
}
74-
let hasChildren = false;
75-
if (this.#reported[0] && this.#reported[0].nesting === data.nesting && this.#reported[0].name === data.name) {
76-
ArrayPrototypeShift(this.#reported);
77-
hasChildren = true;
78-
}
7974
const indentation = indent(data.nesting);
80-
return `${formatTestReport(type, data, prefix, indentation, hasChildren, false)}\n`;
75+
return `${formatTestReport(type, data, false, prefix, indentation)}\n`;
8176
}
8277
#handleEvent({ type, data }) {
8378
switch (type) {

lib/internal/test_runner/reporter/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ function formatError(error, indent) {
6767
return `\n${indent} ${message}\n`;
6868
}
6969

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

0 commit comments

Comments
 (0)