Skip to content

Commit fed35bc

Browse files
committed
Gearing up to "make amp do it"
1 parent e36ea33 commit fed35bc

File tree

3 files changed

+28
-40
lines changed

3 files changed

+28
-40
lines changed

examples/inspector/vite.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import tailwindcss from '@tailwindcss/vite'
66
export default defineConfig({
77
plugins: [react(), tailwindcss()],
88
build: {
9-
// @ts-ignore
10-
minify: !process.env.NO_MINIFY,
9+
// @ts-expect-error I don't want to install @types/node for this one line
10+
minify: process.env.NO_MINIFY !== "true",
1111
},
1212
})

test/integration/mcp-connection.test.ts

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -217,23 +217,23 @@ describe('MCP Connection Integration Tests', () => {
217217

218218
const testScenarios = [
219219
// Working examples with auto transport (should pass)
220-
{ serverName: 'hono-mcp', transportType: 'auto' as const, shouldPass: true },
221-
{ serverName: 'cf-agents', transportType: 'auto' as const, shouldPass: true },
220+
{ serverName: 'hono-mcp', transportType: 'auto' as const },
221+
{ serverName: 'cf-agents', transportType: 'auto' as const },
222222

223223
// SSE endpoint with SSE transport (should pass)
224-
{ serverName: 'cf-agents-sse', transportType: 'sse' as const, shouldPass: true },
224+
{ serverName: 'cf-agents-sse', transportType: 'sse' as const },
225225

226226
// Additional test cases for HTTP transport
227-
{ serverName: 'hono-mcp', transportType: 'http' as const, shouldPass: true },
228-
{ serverName: 'cf-agents', transportType: 'http' as const, shouldPass: true },
227+
{ serverName: 'hono-mcp', transportType: 'http' as const },
228+
{ serverName: 'cf-agents', transportType: 'http' as const },
229229

230230
// Failing case: SSE endpoint with auto transport (should fail)
231-
{ serverName: 'cf-agents-sse', transportType: 'auto' as const, shouldPass: false },
231+
{ serverName: 'cf-agents-sse', transportType: 'auto' as const },
232232
]
233233

234234
test.each(testScenarios)(
235235
'should connect to $serverName with $transportType transport (expect: $shouldPass)',
236-
async ({ serverName, transportType, shouldPass }) => {
236+
async ({ serverName, transportType }) => {
237237
const servers = getMCPServers()
238238
const server = servers.find((s) => s.name === serverName)
239239

@@ -245,38 +245,25 @@ describe('MCP Connection Integration Tests', () => {
245245

246246
const result = await connectToMCPServer(page, server.url, transportType)
247247

248-
if (shouldPass) {
249-
if (result.success) {
250-
console.log(`✅ Successfully connected to ${server.name}`)
251-
console.log(`📋 Available tools (${result.tools.length}):`)
252-
result.tools.forEach((tool, index) => {
253-
console.log(` ${index + 1}. ${tool}`)
254-
})
255-
256-
// Verify connection success
257-
expect(result.success).toBe(true)
258-
expect(result.tools.length).toBeGreaterThanOrEqual(server.expectedTools)
259-
} else {
260-
console.log(`❌ Failed to connect to ${server.name}`)
261-
if (result.debugLog) {
262-
console.log(`🐛 Debug log:`)
263-
console.log(result.debugLog)
264-
}
248+
if (result.success) {
249+
console.log(`✅ Successfully connected to ${server.name}`)
250+
console.log(`📋 Available tools (${result.tools.length}):`)
251+
result.tools.forEach((tool, index) => {
252+
console.log(` ${index + 1}. ${tool}`)
253+
})
265254

266-
// Fail the test with detailed information
267-
throw new Error(`Expected to connect to ${server.name} with ${transportType} transport but failed. Debug log: ${result.debugLog}`)
268-
}
255+
// Verify connection success
256+
expect(result.success).toBe(true)
257+
expect(result.tools.length).toBeGreaterThanOrEqual(server.expectedTools)
269258
} else {
270-
// Expect failure
271-
if (result.success) {
272-
console.log(`❌ Unexpectedly connected to ${server.name}`)
273-
throw new Error(`Expected connection to ${server.name} with ${transportType} transport to fail, but it succeeded`)
274-
} else {
275-
console.log(`✅ Connection to ${server.name} failed as expected`)
276-
console.log(`🐛 Debug log: ${result.debugLog}`)
277-
// Verify it's actually a failure
278-
expect(result.success).toBe(false)
259+
console.log(`❌ Failed to connect to ${server.name}`)
260+
if (result.debugLog) {
261+
console.log(`🐛 Debug log:`)
262+
console.log(result.debugLog)
279263
}
264+
265+
// Fail the test with detailed information
266+
throw new Error(`Expected to connect to ${server.name} with ${transportType} transport but failed. Debug log: ${result.debugLog}`)
280267
}
281268
},
282269
45000,

test/setup/global-setup.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,13 @@ function findAvailablePortFromBase(basePort: number): Promise<number> {
113113
})
114114
}
115115

116-
function runCommand(command: string, args: string[], cwd: string): Promise<void> {
116+
function runCommand(command: string, args: string[], cwd: string, env?: Record<string, string>): Promise<void> {
117117
return new Promise((resolve, reject) => {
118118
const child = spawn(command, args, {
119119
cwd,
120120
stdio: 'inherit',
121121
shell: true,
122+
env: env ? { ...process.env, ...env } : process.env,
122123
})
123124

124125
child.on('close', (code) => {
@@ -209,7 +210,7 @@ export default async function globalSetup() {
209210
// Step 2: Build inspector example
210211
console.log('📦 Building inspector example...')
211212
const inspectorDir = join(rootDir, 'examples/inspector')
212-
await runCommand('pnpm', ['build'], inspectorDir)
213+
await runCommand('pnpm', ['build'], inspectorDir, {NO_MINIFY: "true"})
213214

214215
// Step 3: Find available port and start hono-mcp server
215216
console.log('🔍 Finding available port starting from 9901...')

0 commit comments

Comments
 (0)