Fake child process that exits with a failure code.
(stderr = '')
| 86 | |
| 87 | /** Fake child process that exits with a failure code. */ |
| 88 | function fakeChildFailure(stderr = '') { |
| 89 | const child: any = new EventEmitter(); |
| 90 | child.stdout = new EventEmitter(); |
| 91 | child.stderr = new EventEmitter(); |
| 92 | child.stdin = { end: vi.fn() }; |
| 93 | setImmediate(() => { |
| 94 | if (stderr) { |
| 95 | child.stderr.emit('data', Buffer.from(stderr)); |
| 96 | } |
| 97 | child.emit('close', 1); |
| 98 | }); |
| 99 | return child; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * Fake long-running child process (e.g. `docker run`) that stays alive until |