@@ -229,9 +229,9 @@ describe("registerCommands", () => {
229229 const help = program . helpInformation ( ) ;
230230
231231 expect ( help ) . toMatch ( / S e t u p : [ \s \S ] * a g e n t s \s + l i s t s u p p o r t e d A I a g e n t p r o v i d e r s a n d r e a d i n e s s / ) ;
232- expect ( help ) . toMatch ( / S e t u p : [ \s \S ] * c o n f i g \s + r e a d a n d w r i t e c o d e a l m a n a c s e t t i n g s / ) ;
232+ expect ( help ) . toMatch ( / S e t u p : [ \s \S ] * c o n f i g \s + r e a d a n d w r i t e A l m a n a c s e t t i n g s / ) ;
233233 expect ( help ) . toContain ( "Deprecated:" ) ;
234- expect ( help ) . toMatch ( / s e t < k e y > \[ v a l u e \. \. \. \] \s + c o n f i g u r e c o d e a l m a n a c d e f a u l t s / ) ;
234+ expect ( help ) . toMatch ( / s e t < k e y > \[ v a l u e \. \. \. \] \s + c o n f i g u r e A l m a n a c d e f a u l t s / ) ;
235235 expect ( help ) . toMatch ( / p s \[ o p t i o n s \] \s + d e p r e c a t e d a l i a s f o r j o b s / ) ;
236236 } ) ;
237237} ) ;
@@ -374,42 +374,22 @@ describe("run() — codealmanac-setup shortcut routing", () => {
374374 } ) ;
375375 } ) ;
376376
377- it ( "does NOT shortcut when the binary name is `almanac`" , async ( ) => {
378- // `almanac --yes` without a subcommand isn't a setup invocation —
379- // it's a commander error ("unknown option '--yes'"). We verify
380- // runSetup was NOT called. Commander will write to stderr;
381- // capture + silence it.
377+ it ( "routes bare `almanac --yes` to setup" , async ( ) => {
382378 const setupMock = vi
383379 . fn < ( opts ?: unknown ) => Promise < SetupResult > > ( )
384380 . mockResolvedValue ( { stdout : "" , stderr : "" , exitCode : 0 } ) ;
385381
386- // Commander prints to stderr + throws via `exitOverride` or process.exit;
387- // we swallow either to keep the test surface clean.
388- const origErr = process . stderr . write . bind ( process . stderr ) ;
389- process . stderr . write = ( ( ) => true ) as typeof process . stderr . write ;
390- const origExit = process . exit ;
391- process . exit = ( ( code ?: number ) : never => {
392- throw new Error ( `process.exit called with ${ code } ` ) ;
393- } ) as typeof process . exit ;
394-
395- try {
396- await run (
397- [ "/abs/node" , "/abs/path/almanac" , "--yes" ] ,
398- {
399- runSetup : setupMock as never ,
400- announceUpdate : ( ) => { } ,
401- scheduleUpdateCheck : ( ) => { } ,
402- runInternalUpdateCheck : async ( ) => { } ,
403- } ,
404- ) . catch ( ( ) => {
405- // Swallow — commander's unknown-option error bubbles here.
406- } ) ;
407- } finally {
408- process . stderr . write = origErr ;
409- process . exit = origExit ;
410- }
382+ await run (
383+ [ "/abs/node" , "/abs/path/almanac" , "--yes" ] ,
384+ {
385+ runSetup : setupMock as never ,
386+ announceUpdate : ( ) => { } ,
387+ scheduleUpdateCheck : ( ) => { } ,
388+ runInternalUpdateCheck : async ( ) => { } ,
389+ } ,
390+ ) ;
411391
412- expect ( setupMock ) . not . toHaveBeenCalled ( ) ;
392+ expect ( setupMock ) . toHaveBeenCalledWith ( { yes : true } ) ;
413393 } ) ;
414394
415395 it ( "does NOT shortcut for `codealmanac doctor`" , async ( ) => {
0 commit comments