From 6ed9cd5359e4c3aca427d51636a4c2994c37f9b5 Mon Sep 17 00:00:00 2001 From: Jeremy McSpadden Date: Mon, 16 Mar 2026 16:53:34 -0500 Subject: [PATCH] fix: resolve CI failures in VS Code extension PR - Fix Windows MCP test failures: use pathToFileURL() instead of bare join() paths for dynamic imports, fixing ERR_UNSUPPORTED_ESM_URL_SCHEME on Windows where D:\ paths are not valid ESM import specifiers - Remove parallel orchestration code that was WIP from another feature branch and not part of the VS Code extension scope (commands.ts, preferences.ts, types.ts changes reverted to main) - Rebase cleanly onto main, resolving mcp-server.ts merge conflict by keeping main's dynamic import approach with PR's exported interface and JSDoc documentation --- src/tests/mcp-server.test.ts | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/tests/mcp-server.test.ts b/src/tests/mcp-server.test.ts index 9e4f5cb8a..9581809dd 100644 --- a/src/tests/mcp-server.test.ts +++ b/src/tests/mcp-server.test.ts @@ -1,30 +1,37 @@ import test from 'node:test' import assert from 'node:assert/strict' import { join } from 'node:path' -import { fileURLToPath } from 'node:url' +import { fileURLToPath, pathToFileURL } from 'node:url' const projectRoot = join(fileURLToPath(import.meta.url), '..', '..', '..') +/** + * Resolve dist path as a file:// URL for cross-platform dynamic import. + * On Windows, bare paths like `D:\...\mcp-server.js` fail with + * ERR_UNSUPPORTED_ESM_URL_SCHEME because Node's ESM loader requires + * file:// URLs for absolute paths. + */ +function distUrl(filename: string): string { + return pathToFileURL(join(projectRoot, 'dist', filename)).href +} + test('mcp-server module imports without errors', async () => { // Import from the compiled dist output to avoid subpath resolution issues // that occur when the resolve-ts test hook rewrites .js -> .ts paths. - const distPath = join(projectRoot, 'dist', 'mcp-server.js') - const mod = await import(distPath) + const mod = await import(distUrl('mcp-server.js')) assert.ok(mod, 'module should be importable') assert.strictEqual(typeof mod.startMcpServer, 'function', 'startMcpServer should be a function') }) test('startMcpServer accepts the correct argument shape', async () => { - const distPath = join(projectRoot, 'dist', 'mcp-server.js') - const { startMcpServer } = await import(distPath) + const { startMcpServer } = await import(distUrl('mcp-server.js')) assert.strictEqual(typeof startMcpServer, 'function') assert.strictEqual(startMcpServer.length, 1, 'startMcpServer should accept one argument') }) test('startMcpServer can be called with mock tools', async () => { - const distPath = join(projectRoot, 'dist', 'mcp-server.js') - const { startMcpServer } = await import(distPath) + const { startMcpServer } = await import(distUrl('mcp-server.js')) // Create a mock tool matching the McpToolDef interface const mockTool = {