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

Function fakeProcess

packages/agent-core/test/agent/context.test.ts:191–207  ·  view source on GitHub ↗
(stdout: string)

Source from the content-addressed store, hash-verified

189
190 it('runs a shell command via the Bash tool and records its output', async () => {
191 const fakeProcess = (stdout: string): KaosProcess => {
192 const out = Readable.from([stdout]);
193 const err = Readable.from([]);
194 return {
195 stdin: { end: vi.fn(), write: vi.fn() } as unknown as Writable,
196 stdout: out,
197 stderr: err,
198 pid: 1,
199 exitCode: 0,
200 wait: vi.fn(async () => 0),
201 kill: vi.fn(async () => {}),
202 dispose: vi.fn(async () => {
203 out.destroy();
204 err.destroy();
205 }),
206 };
207 };
208 const kaos = createFakeKaos({
209 execWithEnv: vi.fn().mockImplementation(async () => fakeProcess('hello\n')),
210 });

Callers 1

context.test.tsFile · 0.70

Calls 1

destroyMethod · 0.80

Tested by

no test coverage detected