@@ -568,7 +568,6 @@ describe('CLI with yargs (index.ts)', () => {
568568 mockConsoleError . mockClear ( ) ; // Clear before run
569569
570570 await expect ( runMainWithArgs ( [ 'agent_query' , '{"query": "test"' ] ) ) . rejects . toThrowError (
571- // This error is thrown by handleClientCommand and then re-thrown by yargs.fail()
572571 new Error ( "Invalid JSON parameters: Expected ',' or '}' after property value in JSON at position 16" )
573572 ) ;
574573
@@ -661,7 +660,7 @@ describe('CLI with yargs (index.ts)', () => {
661660
662661 // Check if the SUT's yargs middleware logged the port being observed.
663662 const portLogFound = currentMockLoggerInstance . info . mock . calls . some (
664- call => typeof call [ 0 ] === 'string' && call [ 0 ] . includes ( `[SUT_INDEX_TS_YARGS_MW] --port option value at middleware: ${ customPort } ` )
663+ ( call : any ) => typeof call [ 0 ] === 'string' && call [ 0 ] . includes ( `[SUT_INDEX_TS_YARGS_MW] --port option value at middleware: ${ customPort } ` )
665664 ) ;
666665 expect ( portLogFound , `Expected SUT log for --port middleware. Calls: ${ JSON . stringify ( currentMockLoggerInstance . info . mock . calls ) } ` ) . toBe ( true ) ;
667666
@@ -781,7 +780,7 @@ describe('CLI with yargs (index.ts)', () => {
781780 const expectedErrorPattern = / U n k n o w n c o m m a n d : u n k n o w n c o m m a n d | Y o u m u s t p r o v i d e a c o m m a n d t o r u n | N o t e n o u g h n o n - o p t i o n a r g u m e n t s | U n k n o w n a r g u m e n t : u n k n o w n c o m m a n d / ;
782781 await expect ( runMainWithArgs ( [ 'unknowncommand' ] ) ) . rejects . toThrowError ( expectedErrorPattern ) ;
783782
784- const consoleErrorCalls = mockConsoleError . mock . calls . map ( call => call . join ( ' ' ) ) . join ( '\n' ) ;
783+ const consoleErrorCalls = mockConsoleError . mock . calls . map ( ( call : any ) => call . join ( ' ' ) ) . join ( '\n' ) ;
785784 // Check that help output was logged
786785 expect ( consoleErrorCalls ) . toMatch ( / U s a g e : c o d e c o m p a s s < c o m m a n d > \[ o p t i o n s \] / ) ;
787786 // Check that the specific error message from yargs was logged by the .fail() handler's test mode path
@@ -800,7 +799,7 @@ describe('CLI with yargs (index.ts)', () => {
800799 const expectedErrorMsgPattern = / U n k n o w n a r g u m e n t : - - u n k n o w n - o p t i o n | U n k n o w n a r g u m e n t s : u n k n o w n - o p t i o n , u n k n o w n O p t i o n / ;
801800 await expect ( runMainWithArgs ( [ 'start' , '--unknown-option' ] ) ) . rejects . toThrowError ( expectedErrorMsgPattern ) ;
802801
803- const consoleErrorCalls = mockConsoleError . mock . calls . map ( call => call . join ( ' ' ) ) . join ( '\n' ) ;
802+ const consoleErrorCalls = mockConsoleError . mock . calls . map ( ( call : any ) => call . join ( ' ' ) ) . join ( '\n' ) ;
804803 expect ( consoleErrorCalls ) . toMatch ( / U s a g e : c o d e c o m p a s s < c o m m a n d > \[ o p t i o n s \] / ) ;
805804 // Check that the specific error message from yargs was logged by the .fail() handler's test mode path
806805 expect ( consoleErrorCalls ) . toMatch ( / Y A R G S _ F A I L _ T E S T _ M O D E _ E R R O R _ O U T P U T : .* ( U n k n o w n a r g u m e n t : - - u n k n o w n - o p t i o n | U n k n o w n a r g u m e n t s : u n k n o w n - o p t i o n , u n k n o w n O p t i o n ) / s) ;
@@ -882,9 +881,6 @@ describe('CLI with yargs (index.ts)', () => {
882881 process . env . VITEST_TESTING_FAIL_HANDLER = "true" ;
883882 await expect ( runMainWithArgs ( [ 'agent_query' , '{"query":"test_json_rpc_error"}' , '--json' ] ) )
884883 . rejects . toThrow (
885- // The error thrown by yargs.fail() will be an Error instance.
886- // If handleClientCommand throws an error with a jsonRpcError property,
887- // yargs.fail() should re-throw that error object.
888884 expect . objectContaining ( {
889885 message : `Tool 'agent_query' failed: ${ rpcErrorObject . message } ` ,
890886 jsonRpcError : rpcErrorObject ,
@@ -907,7 +903,7 @@ describe('CLI with yargs (index.ts)', () => {
907903 ) ) . toBe ( true ) ;
908904
909905 // yargs .fail() handler also logs
910- const yargsFailOutputLogged = mockConsoleError . mock . calls . some ( call =>
906+ const yargsFailOutputLogged = mockConsoleError . mock . calls . some ( ( call : any ) =>
911907 call [ 0 ] === 'YARGS_FAIL_TEST_MODE_ERROR_OUTPUT:' &&
912908 typeof call [ 1 ] === 'string' && call [ 1 ] . includes ( `Tool 'agent_query' failed: ${ rpcErrorObject . message } ` )
913909 ) ;
@@ -936,7 +932,7 @@ describe('CLI with yargs (index.ts)', () => {
936932 expect ( genericErrorJsonLogged , `Expected console.error to be called with: ${ expectedJsonErrorLog } . Calls: ${ JSON . stringify ( mockConsoleError . mock . calls ) } ` ) . toBe ( true ) ;
937933
938934 // yargs .fail() handler also logs
939- const yargsFailOutputLogged = mockConsoleError . mock . calls . some ( call =>
935+ const yargsFailOutputLogged = mockConsoleError . mock . calls . some ( ( call : any ) =>
940936 call [ 0 ] === 'YARGS_FAIL_TEST_MODE_ERROR_OUTPUT:' &&
941937 typeof call [ 1 ] === 'string' && call [ 1 ] === genericError . message
942938 ) ;
0 commit comments