test: run v1.5-ported integration tests under node-env vitest project (#1307)#1312
Conversation
…1307) Adds an `integration` vitest project alongside `unit` and `storybook` so the 13 v1.5-ported tests that need real HTTP/stdio servers (or fail under happy-dom's SDK mock resolution) run again under node env with 30s timeouts. Restores test-servers/ as a buildable package so the stdio subprocess spawns a real .js file. Drops the v1.5-source `coverage.exclude` globs and fills coverage gaps across the v1.5-ported core/ modules; two large files (inspectorClient.ts, remote/node/server.ts) keep narrow per-file excludes tracked in #1310. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@claude review |
|
Claude finished @cliffhall's task in 3m 24s —— View job PR ReviewOverall: this is a high-quality, well-scoped PR. The vitest-project refactor in Below is one concrete concern worth addressing before merge and a handful of smaller observations. 🟡
|
…rt_error path - Drop `baseUrl` / `paths` / `typeRoots` / `declaration*` from test-servers/tsconfig.json. They were only needed for type resolution, and we already pass `--noCheck` from `test-servers:build`. Under TS 6+ the deprecated `baseUrl` exited with code 2, which silently skipped vitest in the `&&` chains of test:integration / test:coverage / validate. - Rework the "send() throws after closed" test to drive `closed` via an actual transport_error SSE event instead of mutating private state through a cast — matches the real path the branch guards. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Thanks for the review! Addressed in 76a4122: 🟡 #1 — Mutating private The other observations are well-taken; tracking them as non-blocking notes: #2 — #3 — #4 — #5 — Developer trap in |
|
@claude review |
|
Claude finished @cliffhall's task in 7m 51s —— View job PR Review (follow-up pass — commit
|
Summary
Closes #1307. Brings the 13 v1.5-ported integration tests (~10K LOC, excluded under #1302 because happy-dom can't host them) back online under a new
integrationvitest project, drops the broadcoverage.excludeglobs for v1.5-ported source, and fills coverage gaps across nearly every newly-measured file.integrationvitest project:environment: 'node', 30s test/hook timeouts (matches v1.5'score/vitest.config.ts), no setupFiles. Runs the 13 files listed inintegrationTestsinclients/web/vite.config.ts.@modelcontextprotocol/sdk/client/auth.jsto one canonical path and deduping the SDK (the v2 install hoists a second copy at the repo root).vi.mock(...)now hooks the same module the source imports, sodiscovery.test.ts,state-machine.test.ts, andinspectorClient-oauth-fetchFn.test.tspass.test-servers/as a buildable package (matches v1.5): addstest-servers/tsconfig.jsonand atest-servers:buildnpm script. The Vite alias@modelcontextprotocol/inspector-test-servernow points attest-servers/build/index.jssogetTestMcpServerPath()returns a.jspath Node can spawn directly.test:integrationandtest:integration:watchscripts and folds the integration project intotest:coverageso the per-file gate is enforced across both projects in one run.npm run validateand CI's existingtest:coveragestep now cover both. No new CI step needed.coverage.excludeentries for v1.5-ported source (core/mcp/inspectorClient.ts,core/mcp/oauthManager.ts,core/mcp/fetchTracking.ts,core/mcp/messageTrackingTransport.ts,core/mcp/config.ts,core/mcp/node/**,core/mcp/remote/**,core/auth/**,core/storage/**,core/logging/**) and expandscoverage.includeto capturecore/auth/**,core/storage/**,core/logging/**.file-storage.ts,core/auth/storage.ts,fetchTracking.ts,createRemoteLogger.ts,oauth-callback-server.ts,state-machine.ts,storage-node.ts,storage-browser.ts,browser/providers.ts,storage-remote.ts,createRemoteFetch.ts,remote/sessionStorage.ts,remoteClientTransport.ts,remote/node/server.ts(via new endpoint-error tests inremote-transport.test.ts), andnode/config.ts(new 38-test file). All v1.5-ported source files incore/auth/**,core/storage/**,core/logging/**now meet the 90/85/80/50 per-file gate.Two files keep narrow
coverage.excludeentries markedTODO(#1310):inspectorClient.ts(73% lines despite 4005 LOC of integration tests; gaps in OAuth/subscription/error paths) andremote/node/server.ts(88% lines; gaps in transport-failure / 401-propagation paths and the privatecreateTokenAuthProviderhelper). Tracked in #1310.Manual smoke flows from #1302 AC
All three are covered by passing integration tests in this PR (no separate manual sign-off needed):
InspectorClientagainst real stdio MCP server —inspectorClient.test.ts"should connect to server" and the entire "Tool Methods" / "Resource Methods" suites againstgetTestMcpServerCommand().InspectorClient—inspectorClient.test.tsHTTP transport tests +transport.test.tsagainstcreateTestServerHttp({ serverType: 'streamable-http' }).inspectorClient-oauth-e2e.test.ts(43 tests across SSE + streamable-HTTP × static/CIMD/DCR) againstTestServerOAuth.Test plan
npm run validate(lint + format + build + unit + integration with coverage): 126 files / 1403 tests pass, per-file gate green.npm run test:integrationstandalone: 13 files / 298 tests pass.npm run test:storybook: 67 files / 298 tests pass.clients/web/vite.config.tshas no remainingTODO(#1302 follow-up)markers (the two remaining TODOs reference the new follow-up issue Backfill coverage for InspectorClient and remote-server core paths (#1307 follow-up) #1310).🤖 Generated with Claude Code