(name = './coverage/coverage-final.json')
| 100 | * Normalizes paths to keep contents consistent between OS's |
| 101 | */ |
| 102 | export async function readCoverageJson(name = './coverage/coverage-final.json') { |
| 103 | const jsonReport = JSON.parse(readFileSync(name, 'utf8')) as Record<string, FileCoverageData> |
| 104 | |
| 105 | const normalizedReport: typeof jsonReport = {} |
| 106 | |
| 107 | for (const [filename, coverage] of Object.entries(jsonReport)) { |
| 108 | coverage.path = normalizeFilename(coverage.path) |
| 109 | normalizedReport[normalizeFilename(filename)] = coverage |
| 110 | } |
| 111 | |
| 112 | return normalizedReport |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * Read coverage report from file system as Istanbul's `CoverageMap` |
no test coverage detected