@@ -435,37 +435,15 @@ describe('parseArguments', () => {
435435 debugErrorSpy . mockRestore ( ) ;
436436 } ) ;
437437
438- it ( 'should throw an error when resuming a session without prompt in non-interactive mode' , async ( ) => {
438+ it ( 'should allow resuming a session without prompt argument in non-interactive mode (expecting stdin) ' , async ( ) => {
439439 const originalIsTTY = process . stdin . isTTY ;
440440 process . stdin . isTTY = false ;
441441 process . argv = [ 'node' , 'script.js' , '--resume' , 'session-id' ] ;
442442
443- const mockExit = vi . spyOn ( process , 'exit' ) . mockImplementation ( ( ) => {
444- throw new Error ( 'process.exit called' ) ;
445- } ) ;
446-
447- const mockConsoleError = vi
448- . spyOn ( console , 'error' )
449- . mockImplementation ( ( ) => { } ) ;
450- const debugErrorSpy = vi
451- . spyOn ( debugLogger , 'error' )
452- . mockImplementation ( ( ) => { } ) ;
453-
454443 try {
455- await expect ( parseArguments ( { } as Settings ) ) . rejects . toThrow (
456- 'process.exit called' ,
457- ) ;
458-
459- expect ( debugErrorSpy ) . toHaveBeenCalledWith (
460- expect . stringContaining (
461- 'When resuming a session, you must provide a message via --prompt (-p) or stdin' ,
462- ) ,
463- ) ;
464- expect ( mockConsoleError ) . toHaveBeenCalled ( ) ;
444+ const argv = await parseArguments ( { } as Settings ) ;
445+ expect ( argv . resume ) . toBe ( 'session-id' ) ;
465446 } finally {
466- mockExit . mockRestore ( ) ;
467- mockConsoleError . mockRestore ( ) ;
468- debugErrorSpy . mockRestore ( ) ;
469447 process . stdin . isTTY = originalIsTTY ;
470448 }
471449 } ) ;
0 commit comments