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

Function makeDeps

apps/kimi-code/test/cli/export.test.ts:143–189  ·  view source on GitHub ↗
(overrides: Partial<ExportDeps> = {})

Source from the content-addressed store, hash-verified

141}
142
143function makeDeps(overrides: Partial<ExportDeps> = {}): {
144 deps: ExportDeps;
145 stdout: string[];
146 stderr: string[];
147 exitCodes: number[];
148 exportInputs: ExportSessionInput[];
149 listedWorkDirs: string[];
150} {
151 const stdout: string[] = [];
152 const stderr: string[] = [];
153 const exitCodes: number[] = [];
154 const exportInputs: ExportSessionInput[] = [];
155 const listedWorkDirs: string[] = [];
156 const deps: ExportDeps = {
157 listSessions: async (workDir) => {
158 listedWorkDirs.push(workDir);
159 return [];
160 },
161 exportSession: async (input) => {
162 exportInputs.push(input);
163 return makeResult(input.id, input.outputPath ?? join(tmp, `${input.id}.zip`));
164 },
165 confirmPreviousSession: async () => true,
166 getInstallSource: async () => 'npm-global',
167 getShellEnv: () => ({ term: 'xterm-256color', shell: '/bin/zsh' }),
168 version: '1.0.0-test',
169 cwd: () => tmp,
170 stdout: {
171 write: (chunk: string) => {
172 stdout.push(chunk);
173 return true;
174 },
175 },
176 stderr: {
177 write: (chunk: string) => {
178 stderr.push(chunk);
179 return true;
180 },
181 },
182 exit: ((code: number) => {
183 exitCodes.push(code);
184 throw new ExitCalled(code);
185 }) as ExportDeps['exit'],
186 ...overrides,
187 };
188 return { deps, stdout, stderr, exitCodes, exportInputs, listedWorkDirs };
189}
190
191class ExitCalled extends Error {
192 constructor(public readonly code: number) {

Callers 1

export.test.tsFile · 0.70

Calls 2

makeResultFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected