Skip to content

Commit e461d95

Browse files
committed
test: invalid config path case
1 parent 4f145bb commit e461d95

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/processors/gitLeaks.test.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff 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
});

0 commit comments

Comments
 (0)