MCPcopy
hub / github.com/microsoft/vscode-js-debug / fakeChildProcess

Function fakeChildProcess

src/test/node/process-tree.test.ts:15–25  ·  view source on GitHub ↗
(stdoutData: string)

Source from the content-addressed store, hash-verified

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

Callers 1

assertParsesFunction · 0.85

Calls 3

emitMethod · 0.80
stopMethod · 0.65
onceMethod · 0.65

Tested by

no test coverage detected