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

Function buildFileTree

lib/internal/test_runner/utils.js:532–558  ·  view source on GitHub ↗
(summary)

Source from the content-addressed store, hash-verified

530const kSeparator = ' | ';
531
532function buildFileTree(summary) {
533 const tree = { __proto__: null };
534 let treeDepth = 1;
535 let longestFile = 0;
536
537 ArrayPrototypeForEach(summary.files, (file) => {
538 let longestPart = 0;
539 const parts = StringPrototypeSplit(relative(summary.workingDirectory, file.path), sep);
540 let current = tree;
541
542 ArrayPrototypeForEach(parts, (part, index) => {
543 current[part] ||= { __proto__: null };
544 current = current[part];
545 // If this is the last part, add the file to the tree
546 if (index === parts.length - 1) {
547 current.file = file;
548 }
549 // Keep track of the longest part for padding
550 longestPart = MathMax(longestPart, part.length);
551 });
552
553 treeDepth = MathMax(treeDepth, parts.length);
554 longestFile = MathMax(longestPart, longestFile);
555 });
556
557 return { __proto__: null, tree, treeDepth, longestFile };
558}
559
560function getCoverageReport(pad, summary, symbol, color, table) {
561 const prefix = `${pad}${symbol}`;

Callers 1

getCoverageReportFunction · 0.85

Calls 1

relativeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…