Repository navigation
Conversation
The four tests in test-dev-peer-dependency-priority.test.ts were fetching jquery, typescript and next (plus all of next's transitive dependencies) from registry.npmjs.org on every run, which pushed the file past 10s on some CI lanes and occasionally timed out on a cold cache. Point the same scenarios at the local verdaccio fixture's no-deps package so the file never touches the public internet and its wall time is stable regardless of cache state. While here: - replace the hardcoded localhost:9999 "dead registry" with a port-0 Bun.serve that counts requests, turning the weak "stderr doesn't mention GET" check into a positive zero-request assertion - assert the resolved version in bun.lock / node_modules instead of only checking that the lockfile exists - check stderr before exitCode so failures report the actual error - collapse the hand-rolled Promise+Response spawn boilerplate into a small helper using await using
WalkthroughChangesDependency priority tests
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
Comment |
There was a problem hiding this comment.
LGTM — test-only hermeticity fix that swaps live npmjs.org fetches for the local verdaccio fixture.
What was reviewed:
- Confirmed
no-depsexists in the verdaccio fixture with versions 1.0.0 / 1.0.1 / 1.1.0 / 2.0.0, so every spec in the rewritten tests resolves. VerdaccioRegistry,stderrForInstall,await using Bun.serve, and bunfiglinker = "isolated"all match existing harness patterns.- Checked that the four scenarios still exercise the same dev-vs-peer collision shapes (workspace protocol, matching semver, registry-only) and that the new assertions are strictly stronger than the old "lockfile exists" / "stderr has no GET" checks.
Extended reasoning...
Overview
Single-file test refactor of test/cli/install/test-dev-peer-dependency-priority.test.ts. The four existing test.concurrent cases previously installed jquery, typescript, and next from registry.npmjs.org; they now use the no-deps package from the in-tree verdaccio fixture. A shared VerdaccioRegistry is started in beforeAll, a small spawnBun helper replaces the hand-rolled new Promise + new Response(proc.stdout).text() boilerplate, and the hardcoded http://localhost:9999/ dead registry becomes a port-0 Bun.serve that counts hits.
Security risks
None. Test-only change with no runtime code touched. It removes a public-internet dependency, which is explicitly required by the repo's test guidelines.
Level of scrutiny
Low-to-medium. No production code paths change; the risk is limited to weakening or breaking existing test coverage. I compared each of the four scenarios before/after: the dev/peer version-range collision, the workspace-name-shadows-registry-package shape, and the "second install makes zero requests" check are all preserved, and the assertions are tightened (lockfile contents + installed package.json version + positive registryHits === 0) rather than loosened. The move of nodeLinker: "isolated" from package.json to bunfig linker = "isolated" is a lateral config change already used in isolated-install.test.ts and others.
Other factors
- Verified the fixture registry actually ships
no-deps@1.0.0,1.1.0, and2.0.0, so the^1.0.0peer range and the1.0.0/2.0.0pins all resolve as the comments describe. stderrForInstallstrips the[...ms] donetiming line, which makesexpect(stderr).toBe("")on the run-script step safe (that helper is applied to every spawn).await usingon bothBun.spawnandBun.servefollows the pattern used acrosstest/regression/and satisfies the "release every resource before assertions" rule.- PR description reports the file was verified with
bun bd testand drops from ~7.4s cold / timeout to ~3.6s.
Assert the lockfile contains no registry tarball URL instead of a version-specific negative: a registry-resolved no-deps@2.0.0 would have passed the previous check in test 4. Also make test 4's workspace module export a distinguishable value so the runtime require() proves it linked the workspace copy.
There was a problem hiding this comment.
LGTM — test-only refactor that removes the public-internet dependency and tightens assertions.
What was reviewed:
- Confirmed the verdaccio fixture ships
no-depsat 1.0.0 / 1.0.1 / 1.1.0 / 2.0.0, so every version the tests reference exists locally. - Checked that moving
nodeLinker: "isolated"fromworkspacestobunfig.tomllinker = "isolated"preserves the original scenario. - Verified
stderrForInstall,VerdaccioRegistry.registryUrl(), andtempDirusages match harness signatures; the port-0 dead-registry counter replaces the hardcodedlocalhost:9999and the old stderr-GETscan. - The four
test.concurrentcases share one read-only verdaccio instance but each uses its owntempDir, so concurrency is safe.
Extended reasoning...
Overview
Single-file test refactor of test/cli/install/test-dev-peer-dependency-priority.test.ts. The four existing scenarios are kept but repointed from real npm packages (jquery, typescript, next) to the in-tree verdaccio fixture's no-deps package. A file-level VerdaccioRegistry is started in beforeAll, a spawnBun helper replaces the hand-rolled new Promise + new Response(proc.stdout).text() boilerplate, and the "no network on second install" check now uses a port-0 Bun.serve hit counter instead of scanning stderr for GET against a hardcoded localhost:9999. Assertions are strengthened from "bun.lock exists" to checking the resolved lockfile entry and, for the non-workspace case, the installed node_modules/no-deps/package.json.
Security risks
None. Test-only change with no production code touched. It actually reduces attack surface by removing live registry fetches from CI.
Level of scrutiny
Low-to-moderate. This is a hermeticity/flake fix for an existing test file, exactly the kind of change REVIEW.md encourages ("Never contact external network hosts or live registries", "Always use port: 0", "assert the strongest invariant"). The main risk with test rewrites is silently weakening what's asserted; here the assertions are strictly tighter — lockfile contents and installed version are now checked, and the dead-registry probe is a positive expect(hits).toBe(0) rather than a negative stderr scan that could pass vacuously if log format changed.
Other factors
- I confirmed
test/cli/install/registry/packages/no-deps/contains 1.0.0, 1.0.1, 1.1.0 and 2.0.0 tarballs, so the dev-vs-peer version splits (1.0.0vs^1.0.0,2.0.0workspace vs^1.0.0peer) resolve as the comments describe. stderrForInstall(strips the slow-filesystem warning) andVerdaccioRegistry.registryUrl()exist intest/harness.tswith the signatures used here.- The
nodeLinker: "isolated"setting moved from theworkspacesobject tobunfig.tomllinker = "isolated", which is the equivalent knob — the isolated-linker aspect of the original repro is preserved. test.concurrentsharing one verdaccio instance is safe: each test writes to its owntempDirand verdaccio is read-only for these packages.- The PR description reports the file passes under
bun bd testand no longer times out on a cold cache; the bug-hunting system found nothing.
There was a problem hiding this comment.
LGTM — test-only hermeticity fix that swaps npmjs.org for the local verdaccio fixture.
What was reviewed:
- Verified
no-depsversions 1.0.0/1.1.0/2.0.0 exist intest/cli/install/registry/packages/no-deps/, andstderrForInstall/registryUrl()are real harness exports. - Confirmed
linker = "isolated"in bunfig is the established pattern (used in isolated-install.test.ts et al.), so droppingnodeLinkerfrom the workspaces object is equivalent. - Checked the new assertions are strictly stronger than the old ones (lockfile content + installed package.json vs. bare
.exists(); positiveregistryHits === 0vs. stderr grep). - Shared
VerdaccioRegistryundertest.concurrentis read-only and each test uses its owntempDir, so no cross-test interference.
Extended reasoning...
Overview
Single-file test refactor of test/cli/install/test-dev-peer-dependency-priority.test.ts. The four existing scenarios are preserved but re-pointed from real npm packages (jquery, typescript, next) to the verdaccio fixture's no-deps package. A shared VerdaccioRegistry is started in beforeAll, a spawnBun helper replaces the hand-rolled new Promise + new Response(proc.stdout).text() boilerplate, and the hardcoded localhost:9999 dead registry becomes a port-0 Bun.serve that counts hits. No production code is touched.
Security risks
None. Test-only change; the only new surface is a local port-0 HTTP server inside the test process that returns 500 to everything.
Level of scrutiny
Low-to-medium. This is a hermeticity fix that directly implements several REVIEW.md test requirements the original file was violating: no public-internet contact, no hardcoded ports, drain pipes concurrently with Promise.all, assert stderr before exitCode, assert exact resolved versions rather than "lockfile exists". The behaviour under test (dev-vs-peer priority) is unchanged — the dev spec still differs from the peer spec, workspace packages still shadow registry packages of the same name, and the second-install-no-network check is now a positive assertion rather than a stderr heuristic.
Other factors
- Verified the fixture packages referenced actually exist at the versions used (1.0.0, 1.1.0, 2.0.0 all present under
registry/packages/no-deps/). linker = "isolated"in bunfig is the idiom used byisolated-install.test.ts,public-hoist-pattern.test.ts, etc., so moving it out ofworkspaces.nodeLinkeris a lateral change to the more common pattern.stderrForInstallis applied to the non-installtest.jsspawns too, but it only strips the "Slow filesystem" warning, which is harmless for theexpect(stderr).toBe("")checks.- The evidence block shows all four tests passing on the debug build in ~3.6s, and the PR description documents the cold-cache timeout it fixes.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/cli/install/test-dev-peer-dependency-priority.test.ts`:
- Around line 214-220: Remove the `expect(stderr).not.toContain("GET")`
assertion from the test block. This assertion is redundant since the
`expect(registryHits).toBe(0)` check already proves no network requests reached
the registry, and the "GET" assertion cannot fail because log text is suppressed
by BUN_DEBUG_QUIET_LOGS=1, making it brittle and coupled to log formatting.
- Around line 64-66: Update the lockfile assertions in the three affected tests
to detect registry-version entries directly instead of checking
registry.registryUrl(). In the tests around the no-deps assertions, verify the
lockfile does not contain "no-deps@1."; in the test around utils, verify it does
not contain "utils@1.". Preserve the existing workspace-entry assertions where
present.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 9b71741f-cfc2-47fd-8e56-be141e9ec435
📒 Files selected for processing (1)
test/cli/install/test-dev-peer-dependency-priority.test.ts
The registryHits === 0 check is the real proof that no request was made; the stderr text check depended on log formatting.
There was a problem hiding this comment.
LGTM — test-only hermeticity fix that swaps public-registry packages for the local verdaccio no-deps fixture.
What was reviewed:
- Verified
no-deps1.0.0/1.0.1/1.1.0/2.0.0 all exist intest/cli/install/registry/packages/no-deps/, so the dev-vs-peer version splits (1.0.0 pin vs^1.0.0→ 1.1.0; workspace 2.0.0 vs peer 1.0.0) are real and distinguishable. - Checked the
<name>@workspace:packages/<name>lockfile-string oracle against existing usage incatalogs.test.ts/minimum-release-age.test.ts— same format. - Confirmed the shared
VerdaccioRegistry+test.concurrentshape is safe: each test has its owntempDir, andbeforeAllstarts the registry before concurrent bodies run. - Both CodeRabbit threads are resolved; the redundant
not.toContain("GET")was dropped in favor of theregistryHits === 0counter.
Extended reasoning...
Overview
Single-file test refactor of test/cli/install/test-dev-peer-dependency-priority.test.ts. The four existing scenarios are kept but repointed from live npmjs.org packages (jquery, typescript, next) to the in-repo verdaccio no-deps fixture. Along the way the hand-rolled new Promise + new Response(proc.stdout).text() spawn boilerplate is replaced with a spawnBun helper that uses await using and drains stdout/stderr/exited concurrently, the hardcoded http://localhost:9999/ dead registry becomes a port: 0 Bun.serve that counts hits, and assertions are tightened from "lockfile exists" to "lockfile contains the workspace resolution and not the registry URL" plus a runtime check that the linked module reports 2.0.0-workspace.
Security risks
None. Test-only change, no production code paths, no new external inputs. It removes outbound internet access from the test file.
Level of scrutiny
Low-to-moderate. This is a hygiene change to an existing test file that directly addresses two explicit repo rules ("never contact external network hosts or live registries" and "do not hardcode ports"). The main risk is weakening the property under test, so I checked that each rewritten scenario still exercises a dev/peer spec collision where the peer range would resolve to a different concrete package than the dev spec — the fixture publishes 1.0.0/1.0.1/1.1.0/2.0.0 so the ^1.0.0-vs-1.0.0 and 1.0.0-vs-workspace-2.0.0 splits are real. The new assertions (lockfile content, installed package.json version, registryHits === 0, runtime 2.0.0-workspace) are strictly stronger than the old ones (lockfile exists, stderr lacks "GET").
Other factors
- The
nodeLinker: "isolated"workspace option moved tolinker = "isolated"inbunfig.toml; both configure the isolated linker, and the runtimerequire("no-deps").versionassertion would fail if linking behaved differently. stderrForInstallis the harness helper that strips the "Slow filesystem" warning, soexpect(stderr).toBe("")on thetest.jsrun won't flake on that noise.- CodeRabbit raised two points; one was withdrawn after the author explained the
registry.registryUrl()oracle, and the other (drop the vacuousnot.toContain("GET")) was applied in commit07ebec9b. - PR evidence shows all four tests passing under the debug build in ~4s.
|
The diff is ready. Remaining CI failures are unrelated to this test-only change:
Needs a maintainer to merge past the unrelated red. |
|
This is Claude (an AI assistant) writing on Jarred's behalf. Included in #44968. |
What does this PR do?
test/cli/install/test-dev-peer-dependency-priority.test.tswas fetchingjquery,typescriptandnextfrom registry.npmjs.org on every run. Thenextinstall in particular pulls in react, react-dom, sharp, every@next/swc-*platform package, etc. On alpine 3.23 x64 (build #88691) this file took ~11s; locally on a cold cache the Next.js test hits the 5s per-test timeout.This points the same four scenarios at the local verdaccio fixture's
no-depspackage (versions 1.0.0 / 1.1.0 / 2.0.0) so the file never touches the public internet and its wall time is stable regardless of cache state. Nothing about the behaviour under test changes: a workspace package still collides with a registry package of the same name, thedevDependenciesentry still uses a different spec from thepeerDependenciesentry, and we still verify that the dev entry is what gets linked and that a second install makes zero registry requests.While in here:
http://localhost:9999/"dead registry" with a port-0Bun.servethat counts requests, so the "no network on second install" check is a positiveexpect(hits).toBe(0)instead of scanning stderr forGET.bun.lockand (for the non-workspace case) innode_modules/no-deps/package.json, instead of only checking thatbun.lockexists.stderrbeforeexitCodeso a failure reports the actual error.new Promise+new Response(proc.stdout).text()spawn boilerplate into a small helper that usesawait using.How did you verify your code works?
Locally with
bun bd test test/cli/install/test-dev-peer-dependency-priority.test.ts:expect()callsThe warm-cache "after" number includes ~0.8s of verdaccio startup; the win is that the cold-cache path (what CI sees on a fresh lane) no longer depends on npmjs.org latency, and the file can no longer flake on the 5s default timeout.
[stamp-90s] gate passed · iteration 1 · 1 files touched
passes on PR (with fix)
diff hotspot
gate history · 3 passed · 0 rejected · iteration 1
evidence per changed file