* feat(test): run v1.5-ported integration tests under node-env vitest (#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> * test(core): address PR #1312 review — TS6-safe tsconfig, real transport_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> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0ead1deea6
commit
88b55b093b
1 changed files with 2346 additions and 79 deletions
14
AGENTS.md
14
AGENTS.md
|
|
@ -26,8 +26,15 @@ inspector/
|
|||
│ ├── react/ # React hooks over the state stores
|
||||
│ └── storage/ # File and remote storage adapters (Zustand middleware)
|
||||
├── test-servers/ # Composable MCP test servers + fixtures used by integration tests.
|
||||
│ # Aliased as `@modelcontextprotocol/inspector-test-server`
|
||||
│ # in clients/web/vite.config.ts and tsconfig.test.json.
|
||||
│ ├── src/ # TypeScript sources.
|
||||
│ ├── build/ # Built JS (gitignored). Produced by `npm run test-servers:build`
|
||||
│ │ # so integration tests can spawn the stdio server as a real
|
||||
│ │ # subprocess via `node test-servers/build/test-server-stdio.js`.
|
||||
│ └── tsconfig.json # tsc build config (NodeNext, outDir ./build).
|
||||
│ # The Vite alias `@modelcontextprotocol/inspector-test-server`
|
||||
│ # in clients/web/vite.config.ts points at build/index.js
|
||||
│ # (not src/) so `getTestMcpServerPath()` returns a `.js` path.
|
||||
│ # tsconfig.test.json keeps paths pointing at src for typecheck.
|
||||
├── specification/ # Build specification
|
||||
...
|
||||
```
|
||||
|
|
@ -82,7 +89,8 @@ All work should be driven by items on the project board.
|
|||
- In unit tests that expect error output, suppress it from the console
|
||||
- Run unit tests with `npm run test` (or `npm run test:watch` during development) from `clients/web/`
|
||||
- Run `npm run test:coverage` to verify the per-file gate: lines ≥ 90, statements ≥ 85, functions ≥ 80, branches ≥ 50 (CI enforces this gate). Branches is intentionally relaxed because Mantine portal/media-query branches are not exercisable under happy-dom; new business-logic branches should still be covered.
|
||||
- Test files live alongside the source as `<Name>.test.tsx` (or `.test.ts` for non-React modules)
|
||||
- Run `npm run test:integration` (also from `clients/web/`) for the v1.5-ported InspectorClient + transport + auth integration suite. It runs under a separate `integration` vitest project in node env (no happy-dom) with 30s timeouts. The script builds `test-servers/` first via `tsc -p ../../test-servers --noCheck` so the stdio MCP test server can be spawned as a real subprocess. CI runs it as its own step after unit tests.
|
||||
- Test files live alongside the source as `<Name>.test.tsx` (or `.test.ts` for non-React modules). v1.5-ported integration tests live under `clients/web/src/test/core/` and are wired into the `integration` project via the `integrationTests` list in `vite.config.ts`.
|
||||
- Use `renderWithMantine` from `src/test/renderWithMantine.tsx` to render components — it wraps in `MantineProvider` with the project theme
|
||||
|
||||
### Responding to Code Reviews
|
||||
|
|
|
|||
Loading…
Reference in a new issue