| 23 | }); |
| 24 | |
| 25 | function makeDeps(): { |
| 26 | deps: DoctorDeps; |
| 27 | stdout: string[]; |
| 28 | stderr: string[]; |
| 29 | exitCodes: number[]; |
| 30 | } { |
| 31 | const stdout: string[] = []; |
| 32 | const stderr: string[] = []; |
| 33 | const exitCodes: number[] = []; |
| 34 | return { |
| 35 | deps: { |
| 36 | cwd: () => dir, |
| 37 | defaultConfigPath: () => join(dir, 'config.toml'), |
| 38 | defaultTuiConfigPath: () => join(dir, 'tui.toml'), |
| 39 | stdout: { write: (chunk) => stdout.push(chunk) > 0 }, |
| 40 | stderr: { write: (chunk) => stderr.push(chunk) > 0 }, |
| 41 | exit: (code) => { |
| 42 | exitCodes.push(code); |
| 43 | throw new Error(`exit ${String(code)}`); |
| 44 | }, |
| 45 | }, |
| 46 | stdout, |
| 47 | stderr, |
| 48 | exitCodes, |
| 49 | }; |
| 50 | } |
| 51 | |
| 52 | async function writeValidConfig(path = join(dir, 'config.toml')): Promise<void> { |
| 53 | await writeFile( |