(argv: string[])
| 5 | import { OptionConflictError, validateOptions } from '#/cli/options'; |
| 6 | |
| 7 | function parse(argv: string[]): CLIOptions { |
| 8 | let captured: CLIOptions | undefined; |
| 9 | |
| 10 | const program = createProgram( |
| 11 | '0.1.0-test', |
| 12 | (opts) => { |
| 13 | captured = opts; |
| 14 | }, |
| 15 | () => {}, |
| 16 | ); |
| 17 | |
| 18 | program.exitOverride(); |
| 19 | program.configureOutput({ |
| 20 | writeOut: () => {}, |
| 21 | writeErr: () => {}, |
| 22 | }); |
| 23 | |
| 24 | program.parse(['node', 'kimi', ...argv]); |
| 25 | |
| 26 | if (captured === undefined) { |
| 27 | throw new Error('Main action handler was not called'); |
| 28 | } |
| 29 | return captured; |
| 30 | } |
| 31 | |
| 32 | describe('CLI options parsing', () => { |
| 33 | describe('defaults', () => { |
no test coverage detected