🤖 AI Summary
Testing-MCP is a new npm helper and MCP (Model Context Protocol) server that lets AI assistants connect to running Jest/Vitest tests, inspect the live DOM, view console logs, and execute JavaScript/TypeScript inside the test process to iteratively build integration tests. You install the client (npm install -D testing-mcp), add the MCP server to your assistant config (it runs via npx testing-mcp), and call await connect({ context: { screen, fireEvent, userEvent, waitFor }, filePath, port }) from your tests or setup hooks. The assistant can then call tools like get_current_test_state, execute_test_step, finalize_test and get_generated_code to fetch page snapshots, available API metadata, run interactions or assertions, and clean up — all over a WebSocket bridge (default port 3001).
This is significant because it replaces slow write/run/debug loops with real-time AI-driven test writing: the model sees exact testing APIs and DOM state (so it can generate valid code on first try), can run code without modifying files, and exposes typed context descriptions for accurate suggestions. Key technical notes: Node 18+ and ES modules are required; TESTING_MCP must be set locally (the client no-ops in CI), TESTING_MCP_PORT is configurable for parallel instances, tests may need long timeouts (e.g., 10 minutes) for AI interaction, and only one WebSocket per test is supported. The architecture uses three processes (test client, MCP server, AI assistant) with session tracking and reconnection support.
Loading comments...
login to comment
loading comments...
no comments yet