mock-bin
Mock any executable binary
Useful for mocking tests that run executable binary, especially to fake edge cases and increase test coverage.
Install
$ npm install --save-dev mock-bin
Usage
const mockBin = ;const log = 'mocking git!';const unmock = await ;let actual = shellstdout;t; ;actual = shellstdout;t;
API
mockBin(bin, shebang, code)
Returns a promise which resolves with an unmock()
function.
bin
Type: string
EG: 'git'
.
shebang
Type: string
Shebang or environment
EG: '#!/usr/bin/env node'
or 'bash'
code
Type: string
The actual code you want to execute.
Related
- mock-git - Mock any git command
License
MIT © Steve Mao