spawn-mock
Simple mock for child_process.spawn
This is a basic mock for child_process.spawn built on top of
stdio-mock
, if you wish to use this
library, it will likely be very helpful to learn its API for MockReadable
and
MockWritable
.
Let me have it!
npm install --save spawn-mock
API
mockSpawn(callback: (mockChildProcess: MockChildProcess) => any): Spawn
The only function exported by this library takes a callback that allows you to imperatively call methods on to "mock" an actual called child process.
Example:
; ; cp.stdout.on'data', console.logdata.toString // 'hello' // left as an exercise for the reader ;)
Types
Spawn
MockChildProcess
;; declare