* Apply changes to unskip passing tests
(results: TestResult[])
| 211 | * Apply changes to unskip passing tests |
| 212 | */ |
| 213 | function applyUnskips(results: TestResult[]): void { |
| 214 | const passing = results.filter((r) => r.passed); |
| 215 | |
| 216 | // Group by file |
| 217 | const byFile = new Map<string, TestResult[]>(); |
| 218 | for (const result of passing) { |
| 219 | const existing = byFile.get(result.test.file) || []; |
| 220 | existing.push(result); |
| 221 | byFile.set(result.test.file, existing); |
| 222 | } |
| 223 | |
| 224 | for (const [file, tests] of byFile) { |
| 225 | let content = fs.readFileSync(file, "utf-8"); |
| 226 | |
| 227 | // Sort by line number descending so replacements don't shift line numbers |
| 228 | tests.sort((a, b) => b.test.lineNumber - a.test.lineNumber); |
| 229 | |
| 230 | const lines = content.split("\n"); |
| 231 | for (const test of tests) { |
| 232 | const lineIndex = test.test.lineNumber - 1; |
| 233 | lines[lineIndex] = lines[lineIndex].replace("test.skip", "test"); |
| 234 | } |
| 235 | |
| 236 | fs.writeFileSync(file, lines.join("\n")); |
| 237 | console.log(`Updated ${file}: unskipped ${tests.length} tests`); |
| 238 | } |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Generate markdown report |