test: use Turborepo pack task for test isolation - #92575
Merged
timneutkens merged 7 commits intoApr 13, 2026
Merged
Conversation
Contributor
Tests Passed |
timneutkens
force-pushed
the
04-09-test_use_turborepo_pack_for_test_isolation
branch
from
April 9, 2026 14:22
38d17be to
64e7468
Compare
Contributor
Stats from current PR✅ No significant changes detected📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URL |
timneutkens
marked this pull request as ready for review
April 9, 2026 18:09
ztanner
reviewed
Apr 9, 2026
timneutkens
force-pushed
the
04-09-test_use_turborepo_pack_for_test_isolation
branch
from
April 9, 2026 20:04
0eddb2b to
ca7c0c9
Compare
Eliminates the expensive temporary repo directory copy during test setup by leveraging a Turborepo `pack` task. Instead of copying the entire `packages/` directory, mutating `package.json` files, and running `pnpm pack` sequentially, the new flow: - Adds a `pack` task to `turbo.json` that depends on `build` and outputs `packed.tgz` in each package directory - Adds a `pack` script (`pnpm pack --out ./packed.tgz`) to every workspace package - Simplifies `linkPackages` to scan for pre-built tarballs instead of copying/rewriting/packing - Uses package manager `overrides` (pnpm/npm/yarn) to resolve transitive workspace dependencies from local tarballs - Removes `tmpRepoDir` handling from `base.ts` and `run-tests.js` This reduces isolated test setup from ~16s to ~5s on cache hit.
timneutkens
force-pushed
the
04-09-test_use_turborepo_pack_for_test_isolation
branch
from
April 10, 2026 11:44
4b8b004 to
f3b323c
Compare
ztanner
approved these changes
Apr 13, 2026
timneutkens
deleted the
04-09-test_use_turborepo_pack_for_test_isolation
branch
April 13, 2026 15:38
eps1lon
added a commit
that referenced
this pull request
Apr 29, 2026
In #92575 we started using Turborepo to build a fresh copy of Next.js before each test. This can become quite noisy IMO since Turborepo replays logs by default. Now we hide logs for cache hits. If you want to debug logs from cached builds, you should use `pnpm build` directly. ```terminal @next/polyfill-nomodule#build > cache hit, suppressing logs 951e3e04258a486d @next/playwright#build > cache hit, suppressing logs a37fc1279a93411b @next/routing#build > cache hit, suppressing logs e29bf8207712d9ea @next/env#build > cache hit, suppressing logs 6f68cdf7c8f202f6 @next/bundle-analyzer-ui#build > cache hit, suppressing logs 5dbf9112c4f7029e @next/polyfill-module#build > cache hit, suppressing logs 601b6f5afa47853d @vercel/devlow-bench#build > cache hit, suppressing logs dfd1c037ef4e8100 @next/codemod#build > cache hit, suppressing logs a5eac293134b4263 @next/react-refresh-utils#build > cache hit, suppressing logs 51d64c1f7e8e5cfb @next/eslint-plugin-next#build > cache hit, suppressing logs 74ec27fec9910c71 create-next-app#build > cache hit, suppressing logs 0c4c9d38e0e0913e @next/font#build > cache hit, suppressing logs d1d057c5ffe70285 @next/bundle-analyzer#pack-for-isolated-tests > cache hit, suppressing logs 867b1e9082440087 @next/env#pack-for-isolated-tests > cache hit, suppressing logs 50d7a018277cafb8 next-rspack#pack-for-isolated-tests > cache hit, suppressing logs 1046e9cfa3ba6879 @next/mdx#pack-for-isolated-tests > cache hit, suppressing logs 6da45b672b5b081a eslint-config-next#build > cache hit, suppressing logs fcf529c5b1428c5d @next/font#pack-for-isolated-tests > cache hit, suppressing logs 9675f7ed199b9841 next#build > cache hit, suppressing logs 8c62df3806949bad @vercel/turbopack-next#build > cache hit, suppressing logs 94890b06e4b937bf @next/third-parties#build > cache hit, suppressing logs f1da8c56f9222a0c next#pack-for-isolated-tests > cache hit, suppressing logs f11a5a11e2584c14 @next/third-parties#pack-for-isolated-tests > cache hit, suppressing logs 988b5be9471a943e ```
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

What?
Eliminates the expensive temporary repo directory (
tmpRepoDir) copy during isolated test setup by leveraging a Turborepopacktask with caching.Why?
The previous test isolation flow copied the entire
packages/directory to a temp location, mutated everypackage.jsonto rewrite workspace dependency references, and ranpnpm packsequentially for each package. This added ~10s+ of overhead per test suite. With Turborepo caching, repeated runs are 500ms (and can still be improved).How?
pack-for-isolated-teststask toturbo.json(depends onbuild, outputspacked.tgz)pack-for-isolated-testsscript (pnpm pack --out ./packed.tgz) to every workspace packagelinkPackagesinrepo-setup.jsto scan for pre-built tarballs instead of copying/rewriting/packingcreate-next-install.jsto runpnpm turbo run pack(benefits from caching) and use package manageroverrides(pnpm/npm/yarn) to resolve transitive workspace deps from local tarballstmpRepoDirhandling frombase.tsandrun-tests.jsBefore:
createNextInstall~16s (copy + sequential pack)After:
createNextInstall~5s (first run) / ~4s (cached)