next.js
263dac30 - test: use Turborepo pack task for test isolation (#92575)

Commit
47 days ago
test: use Turborepo pack task for test isolation (#92575) ### What? Eliminates the expensive temporary repo directory (`tmpRepoDir`) copy during isolated test setup by leveraging a Turborepo `pack` task with caching. ### Why? The previous test isolation flow copied the entire `packages/` directory to a temp location, mutated every `package.json` to rewrite workspace dependency references, and ran `pnpm pack` sequentially for each package. This added ~10s+ of overhead per test suite. With Turborepo caching, repeated runs are 500ms (and can still be improved). ### How? - Adds a `pack-for-isolated-tests` task to `turbo.json` (depends on `build`, outputs `packed.tgz`) - Adds a `pack-for-isolated-tests` script (`pnpm pack --out ./packed.tgz`) to every workspace package - Simplifies `linkPackages` in `repo-setup.js` to scan for pre-built tarballs instead of copying/rewriting/packing - Updates `create-next-install.js` to run `pnpm turbo run pack` (benefits from caching) and use package manager `overrides` (pnpm/npm/yarn) to resolve transitive workspace deps from local tarballs - Removes `tmpRepoDir` handling from `base.ts` and `run-tests.js` **Before:** `createNextInstall` ~16s (copy + sequential pack) **After:** `createNextInstall` ~5s (first run) / ~4s (cached) <!-- NEXT_JS_LLM_PR -->
Author
Parents
Loading