-
-
Notifications
You must be signed in to change notification settings - Fork 147
Expand file tree
/
Copy pathappServerRuntimeConfig.test.ts
More file actions
47 lines (40 loc) · 1.33 KB
/
Copy pathappServerRuntimeConfig.test.ts
File metadata and controls
47 lines (40 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { afterEach, describe, expect, it, vi } from 'vitest'
const MACOS_NODE_REPL = '/Applications/Codex.app/Contents/Resources/node_repl'
async function loadWithMocks(options: {
platform: NodeJS.Platform
existingPaths: string[]
}) {
vi.resetModules()
vi.doMock('node:fs', () => ({
existsSync: (path: string) => options.existingPaths.includes(path),
}))
vi.stubGlobal('process', {
...process,
platform: options.platform,
env: {},
})
return import('./appServerRuntimeConfig')
}
describe('buildAppServerArgs', () => {
afterEach(() => {
vi.resetModules()
vi.unstubAllGlobals()
vi.doUnmock('node:fs')
})
it('adds the bundled node_repl MCP server on macOS when available', async () => {
const { buildAppServerArgs } = await loadWithMocks({
platform: 'darwin',
existingPaths: [MACOS_NODE_REPL],
})
const args = buildAppServerArgs()
expect(args).toContain(`mcp_servers.node_repl.command="${MACOS_NODE_REPL}"`)
expect(args).toContain('mcp_servers.node_repl.args=["--disable-sandbox"]')
})
it('does not add node_repl on non-macOS hosts', async () => {
const { buildAppServerArgs } = await loadWithMocks({
platform: 'linux',
existingPaths: [MACOS_NODE_REPL],
})
expect(buildAppServerArgs().join('\n')).not.toContain('mcp_servers.node_repl')
})
})