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

Function createCommandKaos

packages/agent-core/test/agent/harness/agent.ts:122–141  ·  view source on GitHub ↗
(stdout: string)

Source from the content-addressed store, hash-verified

120export type TestAgentContext = AgentTestContext;
121
122export function createCommandKaos(stdout: string): Kaos {
123 function createProcess(): KaosProcess {
124 return {
125 stdin: { write: vi.fn(), end: vi.fn() } as unknown as Writable,
126 stdout: Readable.from([stdout]),
127 stderr: Readable.from(['']),
128 pid: 42,
129 exitCode: 0,
130 wait: vi.fn().mockResolvedValue(0),
131 kill: vi.fn().mockResolvedValue(undefined),
132 dispose: vi.fn().mockResolvedValue(undefined),
133 };
134 }
135
136 return createFakeKaos({
137 execWithEnv: vi.fn().mockImplementation(async () => createProcess()),
138 mkdir: vi.fn().mockResolvedValue(undefined),
139 writeText: vi.fn(async (_path: string, content: string) => content.length),
140 });
141}
142
143export function testAgent(options: TestAgentOptions = {}): AgentTestContext {
144 return new AgentTestContext(options);

Callers 6

basic.test.tsFile · 0.90
permission.test.tsFile · 0.90
plan.test.tsFile · 0.90
tool.test.tsFile · 0.90
config.test.tsFile · 0.90
turn.test.tsFile · 0.90

Calls 2

createFakeKaosFunction · 0.90
createProcessFunction · 0.85

Tested by

no test coverage detected