mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
The test was calling `createNext` inside each `it.each` test body, which meant deployment setup time counted against the 60-second per-test timeout introduced in #89929. In deploy mode, `createNext` deploys to Vercel which can exceed 60 seconds. When the test timed out, the `next` local variable was never assigned (the `await createNext(...)` hadn't resolved), so the `afterEach` hook would throw a `TypeError` on `next.destroy()`. This left the module-level `nextInstance` variable pointing at the stale, half-initialized deploy instance. When the next test case started, `createNext` saw the leftover `nextInstance` and threw `"createNext called without destroying previous instance"`. The test now uses `nextTestSetup`, which runs `createNext` in `beforeAll` where it has the longer 120-second `setupTimeout`. Both API route variants (`/api/single` and `/api/multiple`) are real fixture files served from a single instance, so deployment only happens once.