(output)
| 121 | } |
| 122 | |
| 123 | function parseJest(output) { |
| 124 | const result = { passed: 0, failed: 0, errors: 0, skipped: 0, failures: [] }; |
| 125 | |
| 126 | // "Tests: 1 failed, 2 passed, 3 total" or "Tests: 3 passed, 3 total" |
| 127 | const testsLine = output.split('\n').find(l => /^Tests:/i.test(l.trim())); |
| 128 | if (testsLine) { |
| 129 | const p = testsLine.match(/(\d+) passed/); if (p) result.passed = parseInt(p[1], 10); |
| 130 | const f = testsLine.match(/(\d+) failed/); if (f) result.failed = parseInt(f[1], 10); |
| 131 | const s = testsLine.match(/(\d+) skipped/); if (s) result.skipped = parseInt(s[1], 10); |
| 132 | } |
| 133 | |
| 134 | // "● test suite › test name" failure headers |
| 135 | const failHeaderRe = /^\s*●\s+(.+)$/mg; |
| 136 | let m; |
| 137 | while ((m = failHeaderRe.exec(output)) !== null) { |
| 138 | result.failures.push({ name: m[1].trim(), message: '' }); |
| 139 | } |
| 140 | |
| 141 | return result; |
| 142 | } |
| 143 | |
| 144 | function parseVitest(output) { |
| 145 | const result = { passed: 0, failed: 0, errors: 0, skipped: 0, failures: [] }; |
no outgoing calls
no test coverage detected