@@ -849,6 +849,40 @@ describe("issues command", () => {
849849 ) ;
850850 } ) ;
851851
852+ it ( "should pass onlyPotentialFalsePositives: false when --false-positives false" , async ( ) => {
853+ vi . mocked ( AnalysisService . searchRepositoryIssues ) . mockResolvedValue ( {
854+ data : [ ] ,
855+ } as any ) ;
856+
857+ const program = createProgram ( ) ;
858+ await program . parseAsync ( [
859+ "node" , "test" , "issues" , "gh" , "test-org" , "test-repo" ,
860+ "--false-positives" , "false" ,
861+ ] ) ;
862+
863+ expect ( AnalysisService . searchRepositoryIssues ) . toHaveBeenCalledWith (
864+ "gh" , "test-org" , "test-repo" , undefined , 100 ,
865+ { onlyPotentialFalsePositives : false } ,
866+ ) ;
867+ } ) ;
868+
869+ it ( "should pass onlyPotentialFalsePositives: true when --false-positives true" , async ( ) => {
870+ vi . mocked ( AnalysisService . searchRepositoryIssues ) . mockResolvedValue ( {
871+ data : [ ] ,
872+ } as any ) ;
873+
874+ const program = createProgram ( ) ;
875+ await program . parseAsync ( [
876+ "node" , "test" , "issues" , "gh" , "test-org" , "test-repo" ,
877+ "--false-positives" , "true" ,
878+ ] ) ;
879+
880+ expect ( AnalysisService . searchRepositoryIssues ) . toHaveBeenCalledWith (
881+ "gh" , "test-org" , "test-repo" , undefined , 100 ,
882+ { onlyPotentialFalsePositives : true } ,
883+ ) ;
884+ } ) ;
885+
852886 it ( "should display false positive issues in list format" , async ( ) => {
853887 const fpIssue = {
854888 ...mockIssues [ 0 ] ,
@@ -872,8 +906,8 @@ describe("issues command", () => {
872906 } ) ;
873907 } ) ;
874908
875- describe ( "--bulk- ignore flag" , ( ) => {
876- it ( "should error when --overview is combined with --bulk- ignore" , async ( ) => {
909+ describe ( "--ignore flag" , ( ) => {
910+ it ( "should error when --overview is combined with --ignore" , async ( ) => {
877911 const mockExit = vi . spyOn ( process , "exit" ) . mockImplementation ( ( ) => {
878912 throw new Error ( "process.exit called" ) ;
879913 } ) ;
@@ -883,7 +917,7 @@ describe("issues command", () => {
883917 await expect (
884918 program . parseAsync ( [
885919 "node" , "test" , "issues" , "gh" , "test-org" , "test-repo" ,
886- "--bulk- ignore" , "--overview" ,
920+ "--ignore" , "--overview" ,
887921 ] ) ,
888922 ) . rejects . toThrow ( "process.exit called" ) ;
889923
@@ -893,7 +927,7 @@ describe("issues command", () => {
893927 mockExit . mockRestore ( ) ;
894928 } ) ;
895929
896- it ( "should error when --limit is explicitly combined with --bulk- ignore" , async ( ) => {
930+ it ( "should error when --limit is explicitly combined with --ignore" , async ( ) => {
897931 const mockExit = vi . spyOn ( process , "exit" ) . mockImplementation ( ( ) => {
898932 throw new Error ( "process.exit called" ) ;
899933 } ) ;
@@ -903,7 +937,7 @@ describe("issues command", () => {
903937 await expect (
904938 program . parseAsync ( [
905939 "node" , "test" , "issues" , "gh" , "test-org" , "test-repo" ,
906- "--bulk- ignore" , "--limit" , "10" ,
940+ "--ignore" , "--limit" , "10" ,
907941 ] ) ,
908942 ) . rejects . toThrow ( "process.exit called" ) ;
909943
@@ -913,7 +947,7 @@ describe("issues command", () => {
913947 mockExit . mockRestore ( ) ;
914948 } ) ;
915949
916- it ( "should fetch all FP issues with onlyPotentialFalsePositives: true and call bulkIgnoreIssues" , async ( ) => {
950+ it ( "should fetch all issues and call bulkIgnoreIssues with default reason AcceptedUse " , async ( ) => {
917951 vi . mocked ( AnalysisService . searchRepositoryIssues ) . mockResolvedValue ( {
918952 data : mockIssues ,
919953 } as any ) ;
@@ -922,37 +956,37 @@ describe("issues command", () => {
922956 const program = createProgram ( ) ;
923957 await program . parseAsync ( [
924958 "node" , "test" , "issues" , "gh" , "test-org" , "test-repo" ,
925- "--bulk- ignore" ,
959+ "--ignore" ,
926960 ] ) ;
927961
928962 expect ( AnalysisService . searchRepositoryIssues ) . toHaveBeenCalledWith (
929963 "gh" , "test-org" , "test-repo" , undefined , 100 ,
930- { onlyPotentialFalsePositives : true } ,
964+ { } ,
931965 ) ;
932966 expect ( AnalysisService . bulkIgnoreIssues ) . toHaveBeenCalledWith (
933967 "gh" , "test-org" , "test-repo" ,
934968 {
935969 issueIds : [ mockIssues [ 0 ] . issueId , mockIssues [ 1 ] . issueId ] ,
936- reason : "FalsePositive " ,
970+ reason : "AcceptedUse " ,
937971 comment : undefined ,
938972 } ,
939973 ) ;
940974 } ) ;
941975
942- it ( "should show 'No false positive issues found' when API returns empty list" , async ( ) => {
976+ it ( "should show 'No issues found' when API returns empty list" , async ( ) => {
943977 vi . mocked ( AnalysisService . searchRepositoryIssues ) . mockResolvedValue ( {
944978 data : [ ] ,
945979 } as any ) ;
946980
947981 const program = createProgram ( ) ;
948982 await program . parseAsync ( [
949983 "node" , "test" , "issues" , "gh" , "test-org" , "test-repo" ,
950- "--bulk- ignore" ,
984+ "--ignore" ,
951985 ] ) ;
952986
953987 expect ( AnalysisService . bulkIgnoreIssues ) . not . toHaveBeenCalled ( ) ;
954988 const output = getAllOutput ( ) ;
955- expect ( output ) . toContain ( "No false positive issues found" ) ;
989+ expect ( output ) . toContain ( "No issues found matching the current filters " ) ;
956990 } ) ;
957991
958992 it ( "should batch bulkIgnoreIssues calls when there are more than 100 issues" , async ( ) => {
@@ -982,7 +1016,7 @@ describe("issues command", () => {
9821016 const program = createProgram ( ) ;
9831017 await program . parseAsync ( [
9841018 "node" , "test" , "issues" , "gh" , "test-org" , "test-repo" ,
985- "--bulk- ignore" ,
1019+ "--ignore" ,
9861020 ] ) ;
9871021
9881022 // Should have made 2 search calls (paginated)
@@ -1008,41 +1042,90 @@ describe("issues command", () => {
10081042 const program = createProgram ( ) ;
10091043 await program . parseAsync ( [
10101044 "node" , "test" , "issues" , "gh" , "test-org" , "test-repo" ,
1011- "--bulk- ignore" ,
1045+ "--ignore" ,
10121046 "--ignore-comment" , "Verified by security team" ,
10131047 ] ) ;
10141048
10151049 expect ( AnalysisService . bulkIgnoreIssues ) . toHaveBeenCalledWith (
10161050 "gh" , "test-org" , "test-repo" ,
10171051 {
10181052 issueIds : [ mockIssues [ 0 ] . issueId ] ,
1019- reason : "FalsePositive " ,
1053+ reason : "AcceptedUse " ,
10201054 comment : "Verified by security team" ,
10211055 } ,
10221056 ) ;
10231057 } ) ;
10241058
1025- it ( "should combine --bulk- ignore with other filters (--branch, --patterns)" , async ( ) => {
1059+ it ( "should combine --ignore with other filters (--branch, --patterns)" , async ( ) => {
10261060 vi . mocked ( AnalysisService . searchRepositoryIssues ) . mockResolvedValue ( {
10271061 data : [ ] ,
10281062 } as any ) ;
10291063
10301064 const program = createProgram ( ) ;
10311065 await program . parseAsync ( [
10321066 "node" , "test" , "issues" , "gh" , "test-org" , "test-repo" ,
1033- "--bulk- ignore" ,
1067+ "--ignore" ,
10341068 "--branch" , "develop" ,
10351069 "--patterns" , "sql-injection" ,
10361070 ] ) ;
10371071
10381072 expect ( AnalysisService . searchRepositoryIssues ) . toHaveBeenCalledWith (
10391073 "gh" , "test-org" , "test-repo" , undefined , 100 ,
10401074 {
1041- onlyPotentialFalsePositives : true ,
10421075 branchName : "develop" ,
10431076 patternIds : [ "sql-injection" ] ,
10441077 } ,
10451078 ) ;
10461079 } ) ;
1080+
1081+ it ( "should pass --ignore-reason to bulkIgnoreIssues" , async ( ) => {
1082+ vi . mocked ( AnalysisService . searchRepositoryIssues ) . mockResolvedValue ( {
1083+ data : [ mockIssues [ 0 ] ] ,
1084+ } as any ) ;
1085+ vi . mocked ( AnalysisService . bulkIgnoreIssues ) . mockResolvedValue ( undefined as any ) ;
1086+
1087+ const program = createProgram ( ) ;
1088+ await program . parseAsync ( [
1089+ "node" , "test" , "issues" , "gh" , "test-org" , "test-repo" ,
1090+ "--ignore" ,
1091+ "--ignore-reason" , "FalsePositive" ,
1092+ ] ) ;
1093+
1094+ expect ( AnalysisService . bulkIgnoreIssues ) . toHaveBeenCalledWith (
1095+ "gh" , "test-org" , "test-repo" ,
1096+ {
1097+ issueIds : [ mockIssues [ 0 ] . issueId ] ,
1098+ reason : "FalsePositive" ,
1099+ comment : undefined ,
1100+ } ,
1101+ ) ;
1102+ } ) ;
1103+
1104+ it ( "should combine --ignore with --false-positives to ignore only FP issues" , async ( ) => {
1105+ vi . mocked ( AnalysisService . searchRepositoryIssues ) . mockResolvedValue ( {
1106+ data : [ mockIssues [ 0 ] ] ,
1107+ } as any ) ;
1108+ vi . mocked ( AnalysisService . bulkIgnoreIssues ) . mockResolvedValue ( undefined as any ) ;
1109+
1110+ const program = createProgram ( ) ;
1111+ await program . parseAsync ( [
1112+ "node" , "test" , "issues" , "gh" , "test-org" , "test-repo" ,
1113+ "--ignore" ,
1114+ "--false-positives" ,
1115+ ] ) ;
1116+
1117+ expect ( AnalysisService . searchRepositoryIssues ) . toHaveBeenCalledWith (
1118+ "gh" , "test-org" , "test-repo" , undefined , 100 ,
1119+ { onlyPotentialFalsePositives : true } ,
1120+ ) ;
1121+ expect ( AnalysisService . bulkIgnoreIssues ) . toHaveBeenCalledWith (
1122+ "gh" , "test-org" , "test-repo" ,
1123+ {
1124+ issueIds : [ mockIssues [ 0 ] . issueId ] ,
1125+ reason : "AcceptedUse" ,
1126+ comment : undefined ,
1127+ } ,
1128+ ) ;
1129+ } ) ;
10471130 } ) ;
10481131} ) ;
0 commit comments