(filePath)
| 47 | } |
| 48 | |
| 49 | async 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 | |
| 63 | async function parseCoverageJson(filePath) { |
| 64 | const payload = await readJson(filePath); |
no test coverage detected