Skip to content

Commit dbafa5b

Browse files
committed
test_runner: pass pad, truncate and coverage as arguments to coverage report getCell
1 parent b7cdf96 commit dbafa5b

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/internal/test_runner/utils.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ function getCoverageReport(pad, summary, symbol, color, table) {
358358
}
359359

360360

361-
function getCell(string, width, { pad, truncate, coverage }) {
361+
function getCell(string, width, pad, truncate, coverage) {
362362
if (!table) return string;
363363

364364
let result = string;
@@ -374,9 +374,9 @@ function getCoverageReport(pad, summary, symbol, color, table) {
374374

375375
// Head
376376
if (table) report += addTableLine(prefix, tableWidth);
377-
report += `${prefix}${getCell('file', filePadLength, { pad: StringPrototypePadEnd, truncate: truncateEnd })}${kSeparator}` +
378-
`${ArrayPrototypeJoin(ArrayPrototypeMap(kColumns, (column, i) => getCell(column, columnPadLengths[i], { pad: StringPrototypePadStart })), kSeparator)}${kSeparator}` +
379-
`${getCell('uncovered lines', uncoveredLinesPadLength, { truncate: truncateEnd })}\n`;
377+
report += `${prefix}${getCell('file', filePadLength, StringPrototypePadEnd, truncateEnd)}${kSeparator}` +
378+
`${ArrayPrototypeJoin(ArrayPrototypeMap(kColumns, (column, i) => getCell(column, columnPadLengths[i], StringPrototypePadStart)), kSeparator)}${kSeparator}` +
379+
`${getCell('uncovered lines', uncoveredLinesPadLength, false, truncateEnd)}\n`;
380380
if (table) report += addTableLine(prefix, tableWidth);
381381

382382
// Body
@@ -392,15 +392,15 @@ function getCoverageReport(pad, summary, symbol, color, table) {
392392
});
393393
fileCoverage /= kColumnsKeys.length;
394394

395-
report += `${prefix}${getCell(relativePath, filePadLength, { pad: StringPrototypePadEnd, truncate: truncateStart, coverage: fileCoverage })}${kSeparator}` +
396-
`${ArrayPrototypeJoin(ArrayPrototypeMap(coverages, (coverage, j) => getCell(NumberPrototypeToFixed(coverage, 2), columnPadLengths[j], { coverage, pad: StringPrototypePadStart })), kSeparator)}${kSeparator}` +
397-
`${getCell(formatUncoveredLines(file.uncoveredLineNumbers, table), uncoveredLinesPadLength, { truncate: truncateEnd })}\n`;
395+
report += `${prefix}${getCell(relativePath, filePadLength, StringPrototypePadEnd, truncateStart, fileCoverage)}${kSeparator}` +
396+
`${ArrayPrototypeJoin(ArrayPrototypeMap(coverages, (coverage, j) => getCell(NumberPrototypeToFixed(coverage, 2), columnPadLengths[j], StringPrototypePadStart, false, coverage)), kSeparator)}${kSeparator}` +
397+
`${getCell(formatUncoveredLines(file.uncoveredLineNumbers, table), uncoveredLinesPadLength, false, truncateEnd)}\n`;
398398
}
399399

400400
// Foot
401401
if (table) report += addTableLine(prefix, tableWidth);
402-
report += `${prefix}${getCell('all files', filePadLength, { pad: StringPrototypePadEnd, truncate: truncateEnd })}${kSeparator}` +
403-
`${ArrayPrototypeJoin(ArrayPrototypeMap(kColumnsKeys, (columnKey, j) => getCell(NumberPrototypeToFixed(summary.totals[columnKey], 2), columnPadLengths[j], { coverage: summary.totals[columnKey], pad: StringPrototypePadStart })), kSeparator)} |\n`;
402+
report += `${prefix}${getCell('all files', filePadLength, StringPrototypePadEnd, truncateEnd)}${kSeparator}` +
403+
`${ArrayPrototypeJoin(ArrayPrototypeMap(kColumnsKeys, (columnKey, j) => getCell(NumberPrototypeToFixed(summary.totals[columnKey], 2), columnPadLengths[j], StringPrototypePadStart, false, summary.totals[columnKey])), kSeparator)} |\n`;
404404
if (table) report += addTableLine(prefix, tableWidth);
405405

406406
report += `${prefix}end of coverage report\n`;

0 commit comments

Comments
 (0)