@@ -2,6 +2,7 @@ import { CxWrapper } from '../main/wrapper/CxWrapper';
22import { CxCommandOutput } from "../main/wrapper/CxCommandOutput" ;
33import { CxParamType } from "../main/wrapper/CxParamType" ;
44import { BaseTest } from "./BaseTest" ;
5+ import { OssPackage } from "./data/ossTypes" ;
56
67describe ( "ScanCreate cases" , ( ) => {
78 const cxScanConfig = new BaseTest ( ) ;
@@ -173,15 +174,37 @@ describe("ScanCreate cases", () => {
173174 expect ( Number . isInteger ( scanObject . scanDetails [ 0 ] . line ) ) . toBe ( true ) ;
174175 expect ( typeof scanObject . scanDetails [ 0 ] . description ) . toBe ( 'string' ) ;
175176 } ) ;
176-
177+
177178 it ( 'ScanOss Successful case' , async ( ) => {
178179 const wrapper = new CxWrapper ( cxScanConfig ) ;
179- const cxCommandOutput : CxCommandOutput = await wrapper . ossScanResults ( "tsc/tests/data/package.json" ) ;
180+ const cxCommandOutput : CxCommandOutput = await wrapper . ossScanResults ( "tsc/tests/data/package.json" , "" ) ;
180181 console . log ( "Json object from scanOSS successful case: " + JSON . stringify ( cxCommandOutput ) ) ;
181182 expect ( cxCommandOutput . payload ) . toBeDefined ( ) ;
182183 expect ( cxCommandOutput . exitCode ) . toBe ( 0 ) ;
183184 } ) ;
184185
186+ it ( 'ScanOss with ignored package should filter results' , async ( ) => {
187+ const wrapper = new CxWrapper ( cxScanConfig ) ;
188+ const sourceFile = "tsc/tests/data/package.json" ;
189+ const ignoredFile = "tsc/tests/data/checkmarxIgnoredTempFile.json" ;
190+
191+ const cxCommandOutput : CxCommandOutput = await wrapper . ossScanResults ( sourceFile , ignoredFile ) ;
192+
193+ expect ( cxCommandOutput . exitCode ) . toBe ( 0 ) ;
194+ expect ( cxCommandOutput . payload ) . toBeDefined ( ) ;
195+
196+ const results = cxCommandOutput . payload as OssPackage [ ] ;
197+
198+ console . log ( "Filtered OSS packages:" , results ) ;
199+
200+ expect ( results . length ) . toBe ( 1 ) ;
201+
202+ const hasCOA = results . some ( pkg =>
203+ pkg . PackageManager === "coa" && pkg . PackageVersion === "3.1.3"
204+ ) ;
205+ expect ( hasCOA ) . toBe ( false ) ;
206+ } ) ;
207+
185208 it . skip ( 'ScanSecrets Successful case' , async ( ) => {
186209 const wrapper = new CxWrapper ( cxScanConfig ) ;
187210 const cxCommandOutput : CxCommandOutput = await wrapper . secretsScanResults ( "src/tests/data/secret-exposed.txt" ) ;
0 commit comments