package
Mock any executable binary
npm install mock-binGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Mock any executable binary
Useful for mocking tests that run executable binary, especially to fake edge cases and increase test coverage.
$ npm install --save-dev mock-binconst mockBin = require('mock-bin');
const log = 'mocking git!';
const unmock = await mockBin('git', 'node', `console.log('${log}')`);
let actual = shell.exec('git').stdout;
t.is(log + '\n', actual);
unmock();
actual = shell.exec('git').stdout;
t.not(log + '\n', actual);Returns a promise which resolves with an unmock() function.
Type: string
EG: 'git'.
Type: string
Shebang or environment
EG: '#!/usr/bin/env node' or 'bash'
Type: string
The actual code you want to execute.
MIT © Steve Mao
stevemao
maochenyan@gmail.com
Estimated unpacked size across 27 packages.
1.1 MB
Includes dependencies.
5 direct · 5 outdated
^2.3.0
6.1.0
^0.7.0
0.10.0
^2.0.2
9.0.2
^3.3.0
6.0.1
^2.0.0
4.0.0