| 502 | |
| 503 | // --- Test Coverage --- |
| 504 | function formatCoverage(result: ScanResult): string { |
| 505 | const cov = result.testCoverage; |
| 506 | if (!cov || cov.testFiles.length === 0) return ""; |
| 507 | |
| 508 | const lines: string[] = ["# Test Coverage", ""]; |
| 509 | |
| 510 | lines.push(`> **${cov.coveragePercent}%** of routes and models are covered by tests`); |
| 511 | lines.push(`> ${cov.testFiles.length} test files found`); |
| 512 | lines.push(""); |
| 513 | |
| 514 | if (cov.testedRoutes.length > 0) { |
| 515 | lines.push("## Covered Routes", ""); |
| 516 | for (const r of cov.testedRoutes) { |
| 517 | lines.push(`- ${r}`); |
| 518 | } |
| 519 | lines.push(""); |
| 520 | } |
| 521 | |
| 522 | if (cov.testedModels.length > 0) { |
| 523 | lines.push("## Covered Models", ""); |
| 524 | for (const m of cov.testedModels) { |
| 525 | lines.push(`- ${m}`); |
| 526 | } |
| 527 | lines.push(""); |
| 528 | } |
| 529 | |
| 530 | return lines.join("\n"); |
| 531 | } |
| 532 | |
| 533 | // --- CRUD group computation --- |
| 534 | /** |