MCPcopy Index your code
hub / github.com/getsentry/XcodeBuildMCP / createMockFileSystemExecutor

Function createMockFileSystemExecutor

src/test-utils/mock-executors.ts:297–330  ·  view source on GitHub ↗
(
  overrides?: Partial<FileSystemExecutor>,
)

Source from the content-addressed store, hash-verified

295 * Create a mock file system executor for testing
296 */
297export function createMockFileSystemExecutor(
298 overrides?: Partial<FileSystemExecutor>,
299): FileSystemExecutor {
300 const mockWriteStream = ((): WriteStream => {
301 const emitter = new EventEmitter();
302 const stream = Object.assign(emitter, {
303 destroyed: false,
304 write: () => true,
305 end: () => {
306 stream.destroyed = true;
307 emitter.emit('close');
308 },
309 }) as unknown as WriteStream;
310 return stream;
311 })();
312
313 return {
314 mkdir: async (): Promise<void> => {},
315 readFile: async (): Promise<string> => 'mock file content',
316 writeFile: async (): Promise<void> => {},
317 createWriteStream: () => mockWriteStream,
318 cp: async (): Promise<void> => {},
319 readdir: async (): Promise<unknown[]> => [],
320 rm: async (): Promise<void> => {},
321 existsSync: (): boolean => false,
322 stat: async (): Promise<{ isDirectory(): boolean; mtimeMs: number }> => ({
323 isDirectory: (): boolean => true,
324 mtimeMs: Date.now(),
325 }),
326 mkdtemp: async (): Promise<string> => '/tmp/mock-temp-123456',
327 tmpdir: (): string => '/tmp',
328 ...overrides,
329 };
330}
331
332/**
333 * Create a no-op file system executor that throws an error if called

Callers 15

initConfigStoreForTestFunction · 0.90
createFsFunction · 0.90
createFsFixtureFunction · 0.90
initConfigStoreForTestFunction · 0.90
createMcpTestHarnessFunction · 0.90
createSetupFsFunction · 0.90
setup.test.tsFile · 0.90

Calls 1

emitMethod · 0.80

Tested by 12

initConfigStoreForTestFunction · 0.72
createFsFunction · 0.72
createFsFixtureFunction · 0.72
initConfigStoreForTestFunction · 0.72
createSetupFsFunction · 0.72
initConfigStoreForTestFunction · 0.72
initConfigStoreForTestFunction · 0.72
mockFsFunction · 0.72
mockFsFunction · 0.72
createFsWithProfilesFunction · 0.72