Skip to content

test: start pnpm through a shell on Windows in ensureBuilt - #3177

Open
RafalOfficial wants to merge 1 commit into
modelcontextprotocol:mainfrom
RafalOfficial:fix/windows-ensure-built
Open

RafalOfficial wants to merge 1 commit into
modelcontextprotocol:mainfrom
RafalOfficial:fix/windows-ensure-built

Conversation

@RafalOfficial

Copy link
Copy Markdown

Problem

On Windows, the unit suite fails from a checkout without built dist directories. ensureBuilt (the test helper in packages/client and packages/server) runs pnpm build with execFile. On Windows pnpm is a pnpm.cmd shim, and execFile can only start that through a shell, so the build never runs:

FAIL  test/client/coreBoundary.test.ts > @modelcontextprotocol/client ↔ core schema boundary
Error: pnpm build failed in ...\packages\core: spawn pnpm ENOENT
 ❯ ensureBuilt test/helpers/ensureBuilt.ts:103:27

Every suite that needs a built dist fails this way (client: barrelClean, coreBoundary, workerdSchemaPreload; server: barrelClean, workerdSchemaPreload). With pnpm -r test the client failure also stops the run before the middleware and integration packages are tested. CI runs on Ubuntu only, so it does not see this.

Fix

Pass shell: process.platform === 'win32' to the execFile call in both helpers. Nothing changes on other platforms. Test code only, so no changeset.

Testing

Windows 11, Node 24.16.0, pnpm 10.26.1, with this commit applied on current main (919bb8e), after deleting every packages/*/dist. The branch itself is based on the older 9bc40e9; neither helper has changed since, and it merges cleanly:

  • Before: pnpm --filter @modelcontextprotocol/client test → 3 files fail with spawn pnpm ENOENT.
  • After: pnpm -r --filter '!@modelcontextprotocol/test-e2e' test (the CI command) → all packages pass (client 44 files / 1078 tests, server 55 files / 672 tests).
  • pnpm --filter @modelcontextprotocol/client --filter @modelcontextprotocol/server lint and typecheck → clean.

One side effect, on Windows only: Node 24 prints the DEP0190 warning (args passed together with shell: true) when the helper has to build. The arguments are the constant ['build']. I did not test on Linux or macOS; the option is false there.

AI disclosure

This change was found, written and tested with Claude Code (an AI coding agent) running on a Windows machine.

🤖 Generated with Claude Code

ensureBuilt ran `pnpm build` with execFile, which cannot start the
pnpm.cmd shim on Windows, so every suite that needs a built dist failed
there with `spawn pnpm ENOENT`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@RafalOfficial
RafalOfficial requested a review from a team as a code owner November 11, 2026 21:31
@pkg-pr-new

pkg-pr-new Bot commented Nov 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@3177

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@3177

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@3177

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@3177

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@3177

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@3177

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@3177

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@3177

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@3177

commit: d325961

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant