Next.js API Route Handler Tester
JSON →next-test-api-route-handler (NTARH) is a robust utility for confidently unit and integration testing Next.js API routes and handlers. It accurately emulates the Next.js runtime environment, ensuring that `NextRequest` and `NextApiResponse` objects behave as they would in a real Next.js application, including Next.js's patching of the global `fetch` function and correct handling of App Router helper functions like `headers()` and `cookies()`. The current stable version is 5.0.4. The library maintains a rapid release cadence, often issuing updates to ensure compatibility with new Next.js versions, including `canary` releases. Its key differentiator is the deep emulation of Next.js internals, which removes the need for manual mocking with tools like `express` or `node-mocks-http`, and it is automatically tested against various Next.js and Node.js versions.
Traffic · last 30 days ↑150% vs prev 7d
top countries 🇺🇸 United States · 🇨🇦 Canada · 🇫🇷 France · 🇺🇦 Ukraine · 🇩🇪 Germany