Mock any git command
Useful for mocking tests that run git command, especially to fake edge cases and increase test coverage.
Install
$ npm install --save-dev mock-git
Usage
const mockGit = ;const log = 'mocking git bla!';const unmock = await ;let actual = shellstdout;t; actual = shellstdout;t; ;actual = shellstdout;t;
Checkout the tests for more details
API
mockGit(js, [command])
Returns a promise which resolves with an unmock function.
js
Type: string
Nodejs code.
command
Type: string
EG: 'commit'
.
If omitted, it will mock the git binary.
Related
- mock-bin - Mock any executable binary
License
MIT © Steve Mao