File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -252,5 +252,23 @@ describe('gitleaks', () => {
252252 expect ( result . steps [ 0 ] . error ) . to . be . false ;
253253 expect ( stubs . spawn . secondCall . args [ 1 ] ) . to . include ( '--config=../fixtures/gitleaks-config.toml' ) ;
254254 } ) ;
255+
256+ it ( 'should handle invalid custom config path' , async ( ) => {
257+ stubs . getAPIs . returns ( {
258+ gitleaks : {
259+ enabled : true ,
260+ configPath : '/invalid/path.toml'
261+ }
262+ } ) ;
263+
264+ stubs . fs . stat . rejects ( new Error ( 'File not found' ) ) ;
265+
266+ const result = await exec ( req , action ) ;
267+
268+ expect ( result . error ) . to . be . true ;
269+ expect ( result . steps ) . to . have . lengthOf ( 1 ) ;
270+ expect ( result . steps [ 0 ] . error ) . to . be . true ;
271+ expect ( errorStub . calledWith ( 'could not read file at the config path provided, will not be fed to gitleaks' ) ) . to . be . true ;
272+ } ) ;
255273 } ) ;
256274} ) ;
You can’t perform that action at this time.
0 commit comments