MCPcopy Index your code
hub / github.com/nodejs/node / printCoverageBodyTree

Function printCoverageBodyTree

lib/internal/test_runner/utils.js:631–667  ·  view source on GitHub ↗
(tree, depth = 0)

Source from the content-addressed store, hash-verified

629 }
630
631 function printCoverageBodyTree(tree, depth = 0) {
632 for (const key in tree) {
633 if (tree[key].file?.path) {
634 const file = tree[key].file;
635 const fileName = ArrayPrototypePop(StringPrototypeSplit(file.path, sep));
636
637 let fileCoverage = 0;
638 const coverages = ArrayPrototypeMap(kColumnsKeys, (columnKey) => {
639 const percent = file[columnKey];
640 fileCoverage += percent;
641 return percent;
642 });
643 fileCoverage /= kColumnsKeys.length;
644
645 const uncoveredLines = formatUncoveredLines(getUncoveredLines(file.lines), table);
646
647 report += writeReportLine({
648 __proto__: null,
649 file: fileName,
650 depth: depth,
651 coveragesColumns: coverages,
652 fileCoverage: fileCoverage,
653 uncoveredLines: uncoveredLines,
654 });
655 } else {
656 report += writeReportLine({
657 __proto__: null,
658 file: key,
659 depth: depth,
660 coveragesColumns: ArrayPrototypeMap(columnPadLengths, () => ''),
661 fileCoverage: undefined,
662 uncoveredLines: '',
663 });
664 printCoverageBodyTree(tree[key], depth + 1);
665 }
666 }
667 }
668
669 // -------------------------- Coverage Report --------------------------
670 if (table) report += addTableLine(prefix, tableWidth);

Callers 1

getCoverageReportFunction · 0.85

Calls 3

formatUncoveredLinesFunction · 0.85
getUncoveredLinesFunction · 0.85
writeReportLineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…