(run: () => Promise<void>)
| 1029 | }); |
| 1030 | |
| 1031 | async function captureStdout(run: () => Promise<void>): Promise<string> { |
| 1032 | let stdout = ''; |
| 1033 | const originalWrite = process.stdout.write.bind(process.stdout); |
| 1034 | (process.stdout as any).write = ((chunk: unknown) => { |
| 1035 | stdout += String(chunk); |
| 1036 | return true; |
| 1037 | }) as typeof process.stdout.write; |
| 1038 | |
| 1039 | try { |
| 1040 | await run(); |
| 1041 | } finally { |
| 1042 | process.stdout.write = originalWrite; |
| 1043 | } |
| 1044 | |
| 1045 | return stdout; |
| 1046 | } |
| 1047 | |
| 1048 | async function captureOutput( |
| 1049 | run: () => Promise<void>, |
no test coverage detected