fix: resolve mcp-server CI failures

- Add agentBlocks and lookupMessage to controller type declarations
- Separate e2e tests from unit tests via dedicated vitest.e2e.config.ts
  (e2e test requires built dist/index.js, can't run before build step)
- Increase stdio e2e timeout from 5s to 15s for slower CI environments
This commit is contained in:
iliya 2026-03-16 20:11:15 +02:00
parent 729a756f29
commit f5d2b7e14f
5 changed files with 25 additions and 2 deletions

View file

@ -29,7 +29,7 @@
"dev": "tsx src/index.ts",
"lint": "eslint \"src/**/*.ts\"",
"test": "vitest run",
"test:e2e": "pnpm build && vitest run test/stdio.e2e.test.ts",
"test:e2e": "pnpm build && vitest run --config vitest.e2e.config.ts",
"test:watch": "vitest",
"typecheck": "tsc --noEmit",
"typecheck:test": "tsc --noEmit -p tsconfig.test.json",

View file

@ -49,6 +49,7 @@ declare module 'agent-teams-controller' {
export interface ControllerMessageApi {
appendSentMessage(flags: Record<string, unknown>): unknown;
sendMessage(flags: Record<string, unknown>): unknown;
lookupMessage(messageId: string): { message: Record<string, unknown> };
}
export interface ControllerProcessApi {
@ -86,4 +87,15 @@ declare module 'agent-teams-controller' {
}
export function createController(options: ControllerContextOptions): AgentTeamsController;
export interface AgentBlocksApi {
AGENT_BLOCK_TAG: string;
AGENT_BLOCK_OPEN: string;
AGENT_BLOCK_CLOSE: string;
AGENT_BLOCK_RE: RegExp;
stripAgentBlocks(text: string): string;
wrapAgentBlock(text: string): string;
}
export const agentBlocks: AgentBlocksApi;
}

View file

@ -62,7 +62,7 @@ class McpStdIoClient {
}
private async readMessage(expectedId: number) {
const deadline = Date.now() + 5000;
const deadline = Date.now() + 15000;
while (Date.now() < deadline) {
const newlineIndex = this.stdoutBuffer.indexOf('\n');

View file

@ -5,6 +5,7 @@ export default defineConfig({
globals: true,
environment: 'node',
include: ['test/**/*.test.ts'],
exclude: ['test/**/*.e2e.test.ts'],
testTimeout: 15_000,
},
});

View file

@ -0,0 +1,10 @@
import { defineConfig } from 'vitest/config';
export default defineConfig({
test: {
globals: true,
environment: 'node',
include: ['test/**/*.e2e.test.ts'],
testTimeout: 30_000,
},
});