@slbdn/mcp-tester 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.8.0] - 2026-10-23
11
+
12
+ ### Added
13
+ - End-to-end test suites under `src/__tests__/e2e/` covering complete server workflows: lifecycle (start/connect/discover with drift-free repeated discovery, stop, double-stop no-op, restart with fresh process state, zombie-process proof via pidfile, env passthrough, server→client logging notifications), error recovery (mid-session crash → clean teardown, `MCPTimeoutError` with `.timeout`/`.operation` on a hung tool with the server surviving, exact retry accounting via per-tool call stats, `MCPServerError` with `serverCode` preserved), concurrency (20 parallel `echo` calls with per-request pairing, quick-calls-complete-before-large-response ordering, 25 concurrent counter increments serializing to 25, state isolation across two server processes, concurrent stdio + HTTP sessions on one shared HTTP server, `Promise.allSettled` batch isolation), and payload handling (100 KB argument and 1 MB result byte-exact round-trips hashed, 10,000-element array sum, depth-100 nesting, unicode with tabs/newlines, 500 sequential calls within budget). Deterministic env-driven fixture server (`src/__tests__/e2e/fixtures/e2e-server.mjs`) — crash (`E2E_CRASH_ON_TOOL`) / hang (`E2E_HANG_ON_TOOL`) / fail-once (`E2E_FAIL_ONCE`) chaos via env, no randomness. 30 new E2E tests; full suite now 896 tests / 28 suites, added wall time ~9 s.
14
+
15
+ ### Fixed
16
+ - The npm package no longer ships stale compiled test artifacts. `tsc` never cleans `dist/`, so test files compiled by long-ago builds (`dist/__tests__/*.js`, mock-server copies, source maps) lingered and were published in every package despite `src/__tests__` being excluded from compilation for a long time. `npm run build` now runs a `prebuild` clean step (`scripts/clean-dist.mjs`, cross-platform); `npm pack` contains zero `__tests__` files.
17
+
10
18
  ## [1.7.0] - 2026-10-23
11
19
 
12
20
  ### Added
package/README.md CHANGED
@@ -589,9 +589,15 @@ mcp-tester/
589
589
  │ │ ├── validation.ts # Input validation
590
590
  │ │ ├── stdio-transport.ts # Node-only stdio loader (stubbed for browser)
591
591
  │ │ └── env.ts # Environment utilities
592
- │ └── __tests__/ # 866 tests
592
+ │ └── __tests__/ # 896 tests / 28 suites
593
593
  │ ├── everything-server.test.ts # Integration tests (server-everything)
594
594
  │ ├── real-server.test.ts # Integration tests (stdio transport)
595
+ │ ├── e2e/ # End-to-end tests (real spawned servers, deterministic)
596
+ │ │ ├── fixtures/e2e-server.mjs # Deterministic E2E MCP server fixture
597
+ │ │ ├── lifecycle.e2e.test.ts # Start/stop, restart, zombie, env, notifications
598
+ │ │ ├── recovery.e2e.test.ts # Crash, timeout, retry accounting, serverCode
599
+ │ │ ├── concurrency.e2e.test.ts # Fan-out, order, counter integrity, multi-client
600
+ │ │ └── payloads.e2e.test.ts # 1MB, 10k-array, deep-nest, unicode, 500-seq
595
601
  │ ├── websocket-transport.test.ts # WebSocket transport (in-process double)
596
602
  │ ├── cli.test.ts # CLI tool tests
597
603
  │ └── fixtures/mock-server.ts # In-memory mock server
package/docs/testing.md CHANGED
@@ -21,6 +21,14 @@ src/__tests__/
21
21
  ├── advanced.test.ts # Sampling, elicitation
22
22
  ├── real-server.test.ts # Integration tests (stdio transport)
23
23
  ├── everything-server.test.ts # Full integration (server-everything)
24
+ ├── e2e/ # End-to-end tests (real spawned servers)
25
+ │ ├── helpers.ts # startE2EClient / stopE2EClient / waitForPidGone
26
+ │ ├── fixtures/
27
+ │ │ └── e2e-server.mjs # Deterministic E2E MCP server fixture
28
+ │ ├── lifecycle.e2e.test.ts # Start/stop, restart, zombie, env, notifications
29
+ │ ├── recovery.e2e.test.ts # Crash, timeout, retry accounting, serverCode
30
+ │ ├── concurrency.e2e.test.ts # Fan-out, order, counter integrity, multi-client
31
+ │ └── payloads.e2e.test.ts # 1MB, 10k-array, deep-nest, unicode, 500-seq
24
32
  ├── http-transport.test.ts # Streamable HTTP / SSE transport
25
33
  ├── websocket-transport.test.ts # WebSocket transport (in-process double)
26
34
  ├── cli.test.ts # CLI tool tests
@@ -28,6 +36,35 @@ src/__tests__/
28
36
  └── mock-server.ts # In-memory mock MCP server
29
37
  ```
30
38
 
39
+ ## End-to-End Tests
40
+
41
+ The `e2e/` suites spawn **real server processes** over stdio and exercise complete
42
+ workflows: lifecycle, error recovery, concurrency, and large payloads.
43
+
44
+ The fixture server (`src/__tests__/e2e/fixtures/e2e-server.mjs`) is deterministic —
45
+ chaos is selected purely through environment variables, so tests never sleep-and-pray:
46
+
47
+ | Env var | Effect |
48
+ | --- | --- |
49
+ | `E2E_CRASH_ON_TOOL=<name>` | Server calls `process.exit(70)` when that tool is invoked |
50
+ | `E2E_HANG_ON_TOOL=<name>` | Server never responds to that tool |
51
+ | `E2E_FAIL_ONCE=<name>` | First call to that tool fails, later calls succeed |
52
+ | `E2E_PID_FILE=<path>` | Server writes its pid to the file at startup |
53
+ | `E2E_TOKEN=<value>` | Value returned by the `env_dump` tool |
54
+
55
+ Reuse the helpers in your own suites:
56
+
57
+ ```typescript
58
+ import { startE2EClient, stopE2EClient, waitForPidGone } from './e2e/helpers.js';
59
+
60
+ const client = await startE2EClient({ env: { E2E_TOKEN: 'x' }, timeout: 30_000 });
61
+ // ... callTool / listTools against the real process ...
62
+ await stopE2EClient(client);
63
+ ```
64
+
65
+ Each E2E file raises Jest's per-test timeout to 60 s (process spawns are slow on CI
66
+ runners); the suites add ~9 s to `npm test` end-to-end.
67
+
31
68
  ## Writing Tests
32
69
 
33
70
  ### Jest
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slbdn/mcp-tester",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "description": "Minimal MCP client implementation for CI/CD testing of MCP servers",
5
5
  "main": "dist/index.js",
6
6
  "browser": {
@@ -21,6 +21,7 @@
21
21
  ],
22
22
  "scripts": {
23
23
  "build": "tsc && node scripts/copy-templates.mjs",
24
+ "prebuild": "node scripts/clean-dist.mjs",
24
25
  "predev": "node scripts/copy-templates.mjs",
25
26
  "dev": "tsc --watch",
26
27
  "docs": "typedoc",