From 86fe35911d8543fa12ea3503c24de1855f80820e Mon Sep 17 00:00:00 2001 From: Sampson Date: Mon, 10 Aug 2026 12:34:54 -0500 Subject: [PATCH] test(agent-core-v2): resolve MCP stdio fixture paths with fileURLToPath MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit new URL('./fixtures/...', import.meta.url).pathname yields a leading-slash path like /C:/Users/... on Windows, which is not a usable filesystem path. fileURLToPath is the documented, correct conversion — already used elsewhere in this suite (test/lint/op-uniqueness.test.ts, test/lint/vendor-name-gates.test.ts) for the same purpose. --- packages/agent-core-v2/test/mcpCore/stubs.ts | 41 ++++++++++---------- 1 file changed, 21 insertions(+), 20 deletions(-) diff --git a/packages/agent-core-v2/test/mcpCore/stubs.ts b/packages/agent-core-v2/test/mcpCore/stubs.ts index 2e11f25c74..da3caee483 100644 --- a/packages/agent-core-v2/test/mcpCore/stubs.ts +++ b/packages/agent-core-v2/test/mcpCore/stubs.ts @@ -1,6 +1,7 @@ import { randomUUID } from 'node:crypto'; import { createServer, type Server } from 'node:http'; import type { AddressInfo } from 'node:net'; +import { fileURLToPath } from 'node:url'; import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { SSEServerTransport } from '@modelcontextprotocol/sdk/server/sse.js'; @@ -17,26 +18,26 @@ import type { ToolExecution, } from '#/tool/toolContract'; -export const fixturesDir = new URL('./fixtures/', import.meta.url).pathname; -export const stdioFixture = new URL('./fixtures/mock-stdio-server.mjs', import.meta.url).pathname; -export const cwdStdioFixture = new URL('./fixtures/cwd-stdio-server.mjs', import.meta.url).pathname; -export const slowStdioFixture = new URL('./fixtures/slow-stdio-server.mjs', import.meta.url).pathname; -export const slowToolStdioFixture = new URL( - './fixtures/slow-tool-stdio-server.mjs', - import.meta.url, -).pathname; -export const hangingListStdioFixture = new URL( - './fixtures/hanging-list-stdio-server.mjs', - import.meta.url, -).pathname; -export const crashAfterConnectFixture = new URL( - './fixtures/crash-after-connect-stdio-server.mjs', - import.meta.url, -).pathname; -export const stderrThenExitFixture = new URL( - './fixtures/stderr-then-exit-stdio-server.mjs', - import.meta.url, -).pathname; +export const fixturesDir = fileURLToPath(new URL('./fixtures/', import.meta.url)); +export const stdioFixture = fileURLToPath(new URL('./fixtures/mock-stdio-server.mjs', import.meta.url)); +export const cwdStdioFixture = fileURLToPath( + new URL('./fixtures/cwd-stdio-server.mjs', import.meta.url), +); +export const slowStdioFixture = fileURLToPath( + new URL('./fixtures/slow-stdio-server.mjs', import.meta.url), +); +export const slowToolStdioFixture = fileURLToPath( + new URL('./fixtures/slow-tool-stdio-server.mjs', import.meta.url), +); +export const hangingListStdioFixture = fileURLToPath( + new URL('./fixtures/hanging-list-stdio-server.mjs', import.meta.url), +); +export const crashAfterConnectFixture = fileURLToPath( + new URL('./fixtures/crash-after-connect-stdio-server.mjs', import.meta.url), +); +export const stderrThenExitFixture = fileURLToPath( + new URL('./fixtures/stderr-then-exit-stdio-server.mjs', import.meta.url), +); export function createMemoryMcpOAuthStore(): McpOAuthStore { const data = new Map();