support options.mockFile on coffee.fork
fengmk2 opened this issue · comments
Usage
return coffee.fork('cli.js', args)
.beforeScript('mock-os.js')
.expect('stdout', 'homedir = /some/home/dir')
.expect(code, 0)
.end()
- mock-os.js
const mm = require('mm');
const os = require('os');
mm(os, 'homedir', () => '/some/home/dir');
- cli.js
console.log('homedir = %s', require('os').homedir());