argoproj-labs / argocd-bot

Bot to automate Kubernetes deployment via Github PRs
Apache License 2.0
136 stars 21 forks source link

tests stub on exec are not working #3

Closed marcb1 closed 5 years ago

marcb1 commented 5 years ago

The JS code execs a few helper bash scripts. I'm using child_process.exec. When trying to mock this out using sinon.stub, the stub is not working (no data is being returned). Seems that the JS code is not using the mock.

const child_process = require('child_process')
const execStub = sinon.stub(child_process, 'exec')
execStub.returns({'stdout': 'test'})
marcb1 commented 5 years ago

Fixed by: https://github.com/marcb1/argocd-bot/commit/f9077fedc2bb5f966b07dd252e4758c98a6b919e