MCPcopy Create free account
hub / github.com/cortexkit/magic-context / baseOptions

Function baseOptions

packages/cli/src/commands/doctor-pi.test.ts:118–146  ·  view source on GitHub ↗
(root: string, cwd: string, prompts: MockPrompts)

Source from the content-addressed store, hash-verified

116}
117
118function baseOptions(root: string, cwd: string, prompts: MockPrompts): RunDoctorOptions {
119 const storageDir = join(root, ".local", "share", "cortexkit", "magic-context");
120 mkdirSync(storageDir, { recursive: true });
121 writeFileSync(join(storageDir, "context.db"), "mock");
122 let currentDb: Database | null = null;
123 return {
124 cwd,
125 prompts,
126 deps: {
127 detectPiBinary: () => ({
128 path: join(root, ".pi", "bin", "pi"),
129 source: "home",
130 }),
131 getPiVersion: () => "0.74.0",
132 getLatestNpmVersion: () => "0.1.0",
133 openDatabase: () => {
134 currentDb = createMockDb();
135 return currentDb;
136 },
137 isDatabasePersisted: () => true,
138 closeDatabase: () => currentDb?.close(),
139 now: () => new Date("2026-04-28T12:34:56Z"),
140 execFileSync: () => {
141 throw new Error("gh unavailable");
142 },
143 spawnSync: () => ({ status: 1, stdout: "", stderr: "not expected" }) as never,
144 },
145 };
146}
147
148afterEach(() => {
149 if (originalHome === undefined) delete process.env.HOME;

Callers 1

doctor-pi.test.tsFile · 0.85

Calls 2

createMockDbFunction · 0.70
closeMethod · 0.45

Tested by

no test coverage detected