(mode: OutputMode = "human")
| 10 | const noopSignals = makeNoopSignals(); |
| 11 | |
| 12 | export function makeFakeUI(mode: OutputMode = "human"): UI { |
| 13 | return { |
| 14 | mode, |
| 15 | gap: mock(() => {}), |
| 16 | intro: mock(() => {}), |
| 17 | note: mock(() => {}), |
| 18 | outro: mock(() => {}), |
| 19 | confirm: mock(() => Promise.resolve({ ok: false } as const)), |
| 20 | password: mock(() => Promise.resolve({ ok: false } as const)), |
| 21 | withProgress: mock( |
| 22 | async (steps: { message: string; task: () => Promise<unknown> }[]) => { |
| 23 | const results: unknown[] = []; |
| 24 | for (const step of steps) { |
| 25 | results.push(await step.task()); |
| 26 | } |
| 27 | return results; |
| 28 | }, |
| 29 | ) as unknown as UI["withProgress"], |
| 30 | step: mock(() => {}), |
| 31 | success: mock(() => {}), |
| 32 | warn: mock(() => {}), |
| 33 | cancel: mock(() => {}), |
| 34 | json: mock(() => {}), |
| 35 | output: mock(() => {}), |
| 36 | error: mock(() => {}), |
| 37 | info: mock(() => {}), |
| 38 | write: mock(() => {}), |
| 39 | }; |
| 40 | } |
| 41 | |
| 42 | export function makeCtx( |
| 43 | mode: OutputMode = "human", |
no outgoing calls