Clean up npm test plumbing across workspaces#141
Open
MatiasFernandez wants to merge 1 commit into
Open
Conversation
…pm monorepo project
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Bring the monorepo's
npm testplumbing closer to a conventional npm-workspaces setup: make the three workspaces (client,server,mcp-server) run tests consistently, remove a latent divergence between how the root and the workspaces invoked their tests, and drop a Node flag that is now a no-op. Behavioral no-op on the supported toolchain (Node pinned to 24.15.0 via.nvmrc) — verifiednpm testpasses across all three workspaces.What changed
server/package.json— the workspace had noscriptsblock at all, which is why the root had tocd server && npx vitest runas a workaround. Added a standard"test": "vitest run", so it can be driven like any other workspace.package.json— the roottesthand-chained three legs that each invoked their workspace differently (cd server && npx vitest run,npm test --workspace client,cd mcp-server && npx vitest run). Now:test→npm run test --workspaces --if-present(the documented mechanism for running a script across all workspaces).test:server/test:mcp→npm test --workspace <name>, consistent with the existingtest:client, so all per-workspace legs route through the workspace's own script.mcp-server/package.json+package.json— the mcp-server test script carriedNODE_OPTIONS=--experimental-require-moduleto let CommonJSrequire()the ESM-only@modelcontextprotocol/sdk. On Node 24 that flag is a no-op:require(ESM)has been enabled by default since Node v23.0.0 / v22.12.0 / v20.19.0. The inlineNODE_OPTIONS=...syntax is also POSIX-shell-only (breaks on Windowscmd.exe). So:"vitest run"(matchingserver)."engines": { "node": ">=22.12" }to the root to make explicit the Node floor the flag used to paper over.Removing the flag also eliminates the divergence class at its root: with no special flag, the root and workspace invocations can no longer differ.
Verification
npm testpasses across all three workspaces.npm run test:mcp→ 95/95 pass, exit 0, noExperimentalWarning, noERR_REQUIRE_ESM, with the flag removed on Node 24.15.0.