| 15 | const __dirname = path.dirname(fileURLToPath(import.meta.url)) |
| 16 | |
| 17 | function captureOutput() { |
| 18 | const output = [] |
| 19 | return { |
| 20 | write: (chunk, streamType) => { |
| 21 | output.push({ chunk: chunk.toString(), streamType }) |
| 22 | }, |
| 23 | replay: () => { |
| 24 | for (const { chunk, streamType } of output) { |
| 25 | if (streamType === 'stderr') { |
| 26 | process.stderr.write(chunk) |
| 27 | } else { |
| 28 | process.stdout.write(chunk) |
| 29 | } |
| 30 | } |
| 31 | }, |
| 32 | hasOutput: () => output.length > 0, |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | function printTestSummary(results) { |
| 37 | const label = '--- Test Summary ---' |