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

Function createSetupFs

src/cli/commands/__tests__/setup.test.ts:36–97  ·  view source on GitHub ↗
(opts?: {
  storedConfig?: string;
  projectEntries?: Array<{
    name: string;
    isDirectory: () => boolean;
    isSymbolicLink: () => boolean;
  }>;
})

Source from the content-addressed store, hash-verified

34}
35
36function createSetupFs(opts?: {
37 storedConfig?: string;
38 projectEntries?: Array<{
39 name: string;
40 isDirectory: () => boolean;
41 isSymbolicLink: () => boolean;
42 }>;
43}) {
44 let storedConfig = opts?.storedConfig ?? '';
45 const tempFiles = new Map<string, string>();
46
47 const fs = createMockFileSystemExecutor({
48 existsSync: (targetPath) => targetPath === configPath && storedConfig.length > 0,
49 stat: async () => ({ isDirectory: () => true, mtimeMs: 0 }),
50 readdir: async (targetPath) => {
51 if (targetPath === cwd) {
52 return (
53 opts?.projectEntries ?? [
54 {
55 name: 'App.xcworkspace',
56 isDirectory: () => true,
57 isSymbolicLink: () => false,
58 },
59 ]
60 );
61 }
62
63 return [];
64 },
65 readFile: async (targetPath) => {
66 if (targetPath === configPath) {
67 return storedConfig;
68 }
69
70 const tempContent = tempFiles.get(targetPath);
71 if (tempContent != null) {
72 return tempContent;
73 }
74
75 throw new Error(`Unexpected read path: ${targetPath}`);
76 },
77 writeFile: async (targetPath, content) => {
78 if (targetPath === configPath) {
79 storedConfig = content;
80 return;
81 }
82
83 tempFiles.set(targetPath, content);
84 },
85 rm: async (targetPath) => {
86 tempFiles.delete(targetPath);
87 },
88 });
89
90 return {
91 fs,
92 getStoredConfig: () => storedConfig,
93 setTempFile: (targetPath: string, content: string) => {

Callers 2

setup.test.tsFile · 0.85

Calls 2

getMethod · 0.80

Tested by

no test coverage detected