MCPcopy Create free account
hub / github.com/openai/plugins / parseCoverageXml

Function parseCoverageXml

plugins/plugin-eval/src/evaluators/coverage.js:49–61  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

47}
48
49async function parseCoverageXml(filePath) {
50 const text = await readText(filePath);
51 const lineRateMatch = /line-rate="([^"]+)"/.exec(text);
52 if (lineRateMatch) {
53 return Number((Number(lineRateMatch[1]) * 100).toFixed(2));
54 }
55 const coveredMatch = /lines-covered="([^"]+)"/.exec(text);
56 const validMatch = /lines-valid="([^"]+)"/.exec(text);
57 if (coveredMatch && validMatch && Number(validMatch[1]) > 0) {
58 return Number(((Number(coveredMatch[1]) / Number(validMatch[1])) * 100).toFixed(2));
59 }
60 return null;
61}
62
63async function parseCoverageJson(filePath) {
64 const payload = await readJson(filePath);

Callers 1

parseCoverageFileFunction · 0.85

Calls 1

readTextFunction · 0.90

Tested by

no test coverage detected