Keep your fetch calls.
Connect once at startup and keep using your existing fetch calls.
Reproduce the data and page states you need during development, straight from the console.
Empty lists, different prices, error responses. Keep your fetch calls.
npm i @uiwwsw/next-test-mode→npx @uiwwsw/next-test-mode inittest.patch('/api/cart.json', { total: 9.99 })The console and editor use the same package API.
Change the data and the page refreshes automatically.
{
"items": [
{
"name": "Canvas tote",
"price": 24
},
{
"name": "Everyday mug",
"price": 18
}
],
"total": 42
} Only your test session changes. Values survive reloads and are shared by tabs in the same browser. Use test.clear() to finish testing.
Connect once at startup and keep using your existing fetch calls.
Try one-off values in the console. Edit and share reusable scenarios in a separate folder.
From empty lists to error responses, change the data and check the actual page.
Next Test Mode is a fetch mocking and response-patching tool for Next.js development. Reproduce loading, empty, error and custom data states without replacing your existing API client. Explore client rendering and session-scoped server, static and ISR previews in this demo.
Installation and supported rendering modes ↗