Last active
December 28, 2022 08:22
-
-
Save tzafrirben/a945f8efffd55ea2ab0d71534a3762b4 to your computer and use it in GitHub Desktop.
Create a fake child process
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as child_process from 'child_process'; | |
import EventEmitter from 'events'; | |
import { Readable } from 'stream'; | |
const mockChildProcess = (): child_process.ChildProcess => { | |
const proc = new EventEmitter() as child_process.ChildProcess; | |
proc.stdout = new EventEmitter() as Readable; | |
proc.stderr = new EventEmitter() as Readable; | |
return proc; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment