function buildRows
buildRows(
collector: CoverageFileMap,
testFiles: Set<string>,
projectRoot: string
): FileRow[]

Turns the raw coverage map into sorted, test-file-filtered rows with computed percentages.

import * as Report from './report.ts';

const coverage = new Map([
  ['/repo/lib/math.ts', { coverable: new Set([1, 2]), covered: new Map([[1, 3]]), sourceContent: null }],
  ['/repo/test/math-test.ts', { coverable: new Set([1]), covered: new Map([[1, 1]]), sourceContent: null }],
]);
const rows = Report.buildRows(coverage, new Set(['/repo/test/math-test.ts']), '/repo');
rows.map((row) => row.displayPath); // ['lib/math.ts'] — the test file is excluded
rows[0].covered; // 1 — only line 1 had a hit count above zero

Parameters

testFiles: Set<string>
projectRoot: string

Return Type

Usage

import { buildRows } from "lib/coverage/report.ts";