MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / captureProcessWrite

Function captureProcessWrite

apps/kimi-code/test/helpers/process.ts:15–32  ·  view source on GitHub ↗
(stream: 'stdout' | 'stderr')

Source from the content-addressed store, hash-verified

13}
14
15export function captureProcessWrite(stream: 'stdout' | 'stderr'): {
16 readonly chunks: string[];
17 readonly text: () => string;
18 readonly restore: () => void;
19} {
20 const chunks: string[] = [];
21 const target = process[stream];
22 const spy = vi.spyOn(target, 'write').mockImplementation(((chunk: string | Uint8Array) => {
23 chunks.push(typeof chunk === 'string' ? chunk : Buffer.from(chunk).toString('utf8'));
24 return true;
25 }) as never);
26
27 return {
28 chunks,
29 text: () => chunks.join(''),
30 restore: () =>{ spy.mockRestore(); },
31 };
32}

Callers 5

tool-call.test.tsFile · 0.90
run-shell.test.tsFile · 0.90

Calls 2

toStringMethod · 0.65
pushMethod · 0.45

Tested by

no test coverage detected