@@ -853,4 +853,137 @@ describe('CommitManager', () => {
853853 ) . resolves . not . toThrow ( )
854854 } )
855855 } )
856+
857+ describe ( 'commitChanges with skipVerify option' , ( ) => {
858+ beforeEach ( ( ) => {
859+ vi . mocked ( claude . detectClaudeCli ) . mockResolvedValue ( false )
860+ } )
861+
862+ it ( 'should include --no-verify flag when skipVerify is true (no editor review)' , async ( ) => {
863+ vi . mocked ( git . executeGitCommand ) . mockResolvedValue ( '' )
864+
865+ await manager . commitChanges ( mockWorktreePath , {
866+ skipVerify : true ,
867+ noReview : true ,
868+ dryRun : false ,
869+ } )
870+
871+ expect ( git . executeGitCommand ) . toHaveBeenCalledWith (
872+ [ 'commit' , '-m' , 'WIP: Auto-commit uncommitted changes' , '--no-verify' ] ,
873+ { cwd : mockWorktreePath }
874+ )
875+ } )
876+
877+ it ( 'should include --no-verify flag when skipVerify is true (with editor review)' , async ( ) => {
878+ vi . mocked ( git . executeGitCommand ) . mockResolvedValue ( '' )
879+
880+ await manager . commitChanges ( mockWorktreePath , {
881+ skipVerify : true ,
882+ dryRun : false ,
883+ } )
884+
885+ expect ( git . executeGitCommand ) . toHaveBeenCalledWith (
886+ [ 'commit' , '-e' , '-m' , 'WIP: Auto-commit uncommitted changes' , '--no-verify' ] ,
887+ { cwd : mockWorktreePath , stdio : 'inherit' , timeout : 300000 }
888+ )
889+ } )
890+
891+ it ( 'should NOT include --no-verify flag when skipVerify is false' , async ( ) => {
892+ vi . mocked ( git . executeGitCommand ) . mockResolvedValue ( '' )
893+
894+ await manager . commitChanges ( mockWorktreePath , {
895+ skipVerify : false ,
896+ dryRun : false ,
897+ } )
898+
899+ expect ( git . executeGitCommand ) . toHaveBeenCalledWith (
900+ [ 'commit' , '-e' , '-m' , 'WIP: Auto-commit uncommitted changes' ] ,
901+ { cwd : mockWorktreePath , stdio : 'inherit' , timeout : 300000 }
902+ )
903+ } )
904+
905+ it ( 'should NOT include --no-verify flag when skipVerify is undefined' , async ( ) => {
906+ vi . mocked ( git . executeGitCommand ) . mockResolvedValue ( '' )
907+
908+ await manager . commitChanges ( mockWorktreePath , { dryRun : false } )
909+
910+ expect ( git . executeGitCommand ) . toHaveBeenCalledWith (
911+ [ 'commit' , '-e' , '-m' , 'WIP: Auto-commit uncommitted changes' ] ,
912+ { cwd : mockWorktreePath , stdio : 'inherit' , timeout : 300000 }
913+ )
914+ } )
915+
916+ it ( 'should log warning when --no-verify flag is used' , async ( ) => {
917+ const { logger } = await import ( '../utils/logger.js' )
918+ vi . mocked ( git . executeGitCommand ) . mockResolvedValue ( '' )
919+
920+ await manager . commitChanges ( mockWorktreePath , {
921+ skipVerify : true ,
922+ dryRun : false ,
923+ } )
924+
925+ expect ( logger . warn ) . toHaveBeenCalledWith (
926+ expect . stringContaining ( 'Skipping pre-commit hooks' )
927+ )
928+ } )
929+
930+ it ( 'should log correct dry-run message when skipVerify is true' , async ( ) => {
931+ const { logger } = await import ( '../utils/logger.js' )
932+
933+ await manager . commitChanges ( mockWorktreePath , {
934+ skipVerify : true ,
935+ dryRun : true ,
936+ } )
937+
938+ expect ( logger . info ) . toHaveBeenCalledWith (
939+ expect . stringContaining ( '[DRY RUN] Would commit with message --no-verify:' )
940+ )
941+ } )
942+
943+ it ( 'should include --no-verify flag with custom message' , async ( ) => {
944+ vi . mocked ( git . executeGitCommand ) . mockResolvedValue ( '' )
945+
946+ await manager . commitChanges ( mockWorktreePath , {
947+ skipVerify : true ,
948+ message : 'Custom message' ,
949+ dryRun : false ,
950+ } )
951+
952+ expect ( git . executeGitCommand ) . toHaveBeenCalledWith (
953+ [ 'commit' , '-m' , 'Custom message' , '--no-verify' ] ,
954+ { cwd : mockWorktreePath }
955+ )
956+ } )
957+
958+ it ( 'should include --no-verify flag with issue number' , async ( ) => {
959+ vi . mocked ( git . executeGitCommand ) . mockResolvedValue ( '' )
960+
961+ await manager . commitChanges ( mockWorktreePath , {
962+ skipVerify : true ,
963+ issueNumber : 123 ,
964+ dryRun : false ,
965+ } )
966+
967+ expect ( git . executeGitCommand ) . toHaveBeenCalledWith (
968+ [ 'commit' , '-e' , '-m' , 'WIP: Auto-commit for issue #123\n\nFixes #123' , '--no-verify' ] ,
969+ { cwd : mockWorktreePath , stdio : 'inherit' , timeout : 300000 }
970+ )
971+ } )
972+
973+ it ( 'should include --no-verify flag with Claude-generated message' , async ( ) => {
974+ vi . mocked ( claude . detectClaudeCli ) . mockResolvedValue ( true )
975+ vi . mocked ( claude . launchClaude ) . mockResolvedValue ( 'Add authentication feature' )
976+ vi . mocked ( git . executeGitCommand ) . mockResolvedValue ( '' )
977+
978+ await manager . commitChanges ( mockWorktreePath , {
979+ skipVerify : true ,
980+ dryRun : false ,
981+ } )
982+
983+ expect ( git . executeGitCommand ) . toHaveBeenCalledWith (
984+ [ 'commit' , '-e' , '-m' , 'Add authentication feature' , '--no-verify' ] ,
985+ { cwd : mockWorktreePath , stdio : 'inherit' , timeout : 300000 }
986+ )
987+ } )
988+ } )
856989} )
0 commit comments