MCPcopy
hub / github.com/MiniMax-AI/cli / captureStdout

Function captureStdout

test/commands/file/list.test.ts:36–50  ·  view source on GitHub ↗
(fn: () => Promise<void>)

Source from the content-addressed store, hash-verified

34};
35
36async function captureStdout(fn: () => Promise<void>): Promise<string> {
37 const originalWrite = process.stdout.write;
38 let output = '';
39 process.stdout.write = ((chunk: string | Uint8Array) => {
40 output += typeof chunk === 'string' ? chunk : Buffer.from(chunk).toString('utf-8');
41 return true;
42 }) as typeof process.stdout.write;
43
44 try {
45 await fn();
46 return output;
47 } finally {
48 process.stdout.write = originalWrite;
49 }
50}
51
52describe('file list command', () => {
53 let server: MockServer;

Callers 1

list.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected