MCPcopy Create free account
hub / github.com/Snapchat/Valdi / fakeChildProcess

Function fakeChildProcess

valdi/vscode_debugger/src/test/node/process-tree.test.ts:14–24  ·  view source on GitHub ↗
(stdoutData: string)

Source from the content-addressed store, hash-verified

12import { WindowsProcessTree } from '../../ui/processTree/windowsProcessTree';
13
14const fakeChildProcess = (stdoutData: string) => {
15 const ee: any = new EventEmitter();
16 ee.stderr = new ReadableStreamBuffer();
17 ee.stderr.stop();
18 ee.stdout = new ReadableStreamBuffer({ frequency: 2, chunkSize: 32 });
19 ee.stdout.put(stdoutData);
20 ee.stdout.stop();
21 ee.stdout.once('end', () => setTimeout(() => ee.emit('close', 0), 1));
22
23 return ee;
24};
25
26const assertParses = async (tree: IProcessTree, input: string, expected: IProcess[]) => {
27 const stubbed = stub(tree, 'createProcess' as any).returns(fakeChildProcess(input));

Callers 1

assertParsesFunction · 0.85

Calls 4

stopMethod · 0.65
putMethod · 0.65
onceMethod · 0.65
setTimeoutFunction · 0.50

Tested by

no test coverage detected