also looking at this
test: import the CLI without parsing, and pin its wiring in-process
#1448
2 files
+145
-2
| @@ -204,7 +204,7 @@ async function collectPackageContext( | ||
| 204 | 204 | } |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | const cli = new CLI('buddy') | |
| 207 | const cli: CLI = new CLI('buddy') | |
| 208 | 208 | |
| 209 | 209 | cli.usage(`[command] [options] |
| 210 | 210 | |
| @@ -3517,4 +3517,10 @@ cli.command('help', 'Show this help text').action(() => { | ||
| 3517 | 3517 | cli.option('--config <path>', 'Path to a buddy config file') |
| 3518 | 3518 | cli.version(version) |
| 3519 | 3519 | cli.help() |
| 3520 | cli.parse() | |
| 3520 | ||
| 3521 | // Exported for the in-process wiring tests: importing this module must not | |
| 3522 | // parse argv or run a command — only direct execution does. | |
| 3523 | export { cli } | |
| 3524 | ||
| 3525 | if (import.meta.main) | |
| 3526 | cli.parse() | |