in src/coverage-utils/coverage-tracker.ts [69:95]
private async processCoverage(run: TestRun, lcovReportPath: string) {
let lineDetail: fileToLineMapping = this.resultsByRun.get(run) ?? new Map()
this.resultsByRun.set(run, lineDetail)
const workspaceRoot = (await Utils.getWorkspaceGitRoot()) ?? ''
const reportPath = vscode.Uri.parse(lcovReportPath).fsPath
const reportText = createReadStream(reportPath)
const parsedReport = await lcovParser({from: reportText})
for (const fileData of parsedReport) {
// hitsPerLine data is cumulative across all lcov reports in a run.
let hitsPerLine = lineDetail.get(fileData.path) ?? []
lineDetail.set(fileData.path, hitsPerLine)
const fileStatementCoverage = this.getStatementCoverage(
fileData,
hitsPerLine
)
const fileCoverage = vscode.FileCoverage.fromDetails(
vscode.Uri.parse(path.join(workspaceRoot, fileData.path)),
fileStatementCoverage
)
// Add or replace prior coverage data for this file.
this.coverageStore.set(fileCoverage, fileStatementCoverage)
run.addCoverage(fileCoverage)
}
}