Tests and the dev-server MCP
What runs where
Section titled “What runs where”| Runner | Covers | Why that runner |
|---|---|---|
| Vitest 5 | Season window, rate limiter, Zod schema, hostname check | Pure functions; milliseconds |
| Playwright 1.64 | Proxy rewrite, both themes, 404s, canonical links, npm versions, the full contact form | Only a real server exercises proxy + prerender + Server Action together |
"scripts": { "lint": "eslint .", "typecheck": "next typegen && tsc --noEmit", "test": "vitest run", "test:e2e": "playwright test", "verify": "npm run lint && npm run typecheck && npm run test && npm run build"}next lint is gone in 16 — use the ESLint CLI.
Playwright against a production build
Section titled “Playwright against a production build”webServer: { command: `${process.env.E2E_SKIP_BUILD ? "" : "npm run build && "}npx next start -p 3100`, url: "http://localhost:3100/standard", env: { CONTACT_DRY_RUN: "1" }, // log emails instead of sending},The form test fills the form, waits for the Turnstile test widget to set its token, submits, and expects the success message.
The dev-server MCP endpoint
Section titled “The dev-server MCP endpoint”next dev in Next.js 16 serves an MCP endpoint at /_next/mcp. You don’t need
a client for it — it speaks JSON-RPC over HTTP:
curl -s -X POST http://localhost:3000/_next/mcp \ -H 'content-type: application/json' \ -H 'accept: application/json, text/event-stream' \ -d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"get_errors","arguments":{}}}'Useful tools: get_project_metadata, get_routes, get_compilation_issues
(compiles every route without a browser), get_errors (needs the page open in
a browser), get_page_metadata (which layout, page and boundaries rendered),
and get_logs (path to the dev log — where the dry-run emails appear).