Skip to content

test(install): move the arborist fixture cases out of migrate.test.ts - #40977

Open
robobun wants to merge 2 commits into
mainfrom
robobun/61e5071e/npm-arborist-file
Open

robobun wants to merge 2 commits into
mainfrom
robobun/61e5071e/npm-arborist-file

Conversation

@robobun

@robobun robobun commented Aug 30, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

  • test/cli/install/migration/migrate.test.ts took 15.6s on debian 13 x64-asan and 8.1s on windows 11 aarch64 (build 108487), in the serial phase. Its 57 arborist fixture cases run one after another, two bun children each, because snapshot matchers are unsupported in concurrent tests. They are about two thirds of the file's time.
  • The file is excluded from the CI parallel batch since test: pull five batch-flaky files out of the parallel batch #40419, so nothing overlaps with it.

Fix

  • The arborist cases move, unchanged, to test/cli/install/migration/npm-arborist.test.ts. The describe path stays package-lock.json migration fixes > arborist fixtures, so __snapshots__/migrate.test.ts.snap is renamed byte for byte to npm-arborist.test.ts.snap.
  • The helpers both files need (fixture, run, readLock, writeExtra, OFFLINE_REGISTRY, ARBORIST) move to test/cli/install/migration/migration-harness.ts. migrate.test.ts imports them. No test body changes.
  • The new file is in an allowlisted directory and not in excludeFiles, so the runner puts it in the parallel batch once it is on main. It is hermetic: offline registry, own install cache per project.
  • Verified: bun bd test test/cli/install/migration/npm-arborist.test.ts (57 pass, 57 snapshots, none written) and bun bd test test/cli/install/migration/migrate.test.ts (69 pass, 1 todo). Local debug ASAN: migrate.test.ts 29.1s before, 9.1s after. npm-arborist.test.ts 20.8s.

Background

  • bun pm migrate converts a package-lock.json into bun.lock. The arborist fixtures are lockfiles from npm's test suite. Each case migrates one and round-trips it through bun install --frozen-lockfile --lockfile-only, and the report is snapshotted.
  • scripts/runner.node.mjs runs the files of test/parallel-allowlist.json in one parallel batch after the serial phase. A file in a listed directory qualifies unless it is in excludeFiles, which test: pull five batch-flaky files out of the parallel batch #40419 did for migrate.test.ts after batch-only failures.
Notes

Follow-ups. #40956 rewrites the top-level cases of migrate.test.ts on top of this change: they are the cases that reach registry.npmjs.org and GitHub, and the likely reason for the batch-only failures. Once that lands, a maintainer can take cli/install/migration/migrate.test.ts out of test/parallel-denylist.txt and excludeFiles.

Open PRs on this file. git merge-tree against this branch: #38698, #38850, #38804, #38990 and #29509 merge clean. #38861 adds a describe right before the arborist block, so it conflicts on the block's removal; the resolution is to keep its describe.


no test proof · iteration 2 · platform-specific test(s) that do not run on this machine, deferring to CI, which covers all platforms: test/cli/install/migration/migrate.test.ts

The 57 arborist snapshot cases run one after another, two bun children each,
and made migrate.test.ts the longest file of the serial phase. They move to
npm-arborist.test.ts with their snapshot file renamed byte for byte, and the
helpers both files need move to migration-harness.ts. No test changes.

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — mechanical test-only split with no behavior change.

What was reviewed:

  • Verified the extracted helpers in migration-harness.ts and the moved test.each body in npm-arborist.test.ts are byte-identical to what was removed from migrate.test.ts; import.meta.dir resolves to the same directory so ARBORIST is unchanged.
  • Confirmed the snapshot file is a 100% rename and the describe hierarchy (package-lock.json migration fixes > arborist fixtures) is preserved, so all 57 snapshot keys still match.
  • Checked test/parallel-allowlist.json: cli/install/migration is allowlisted and the new file is not in excludeFiles, so it lands in the parallel batch as described.
Extended reasoning...

Overview

This PR splits the 57 sequential arborist-fixture snapshot cases out of test/cli/install/migration/migrate.test.ts (a ~1800-line file) into a new standalone npm-arborist.test.ts, so the CI runner can schedule it in the parallel batch while the remainder of migrate.test.ts stays in excludeFiles. Shared helpers (fixture, run, readLock, writeExtra, OFFLINE_REGISTRY, ARBORIST, arboristFixtures, FixtureDir) are lifted verbatim into migration-harness.ts and re-imported by both test files. The snapshot file is a pure git rename (100% similarity). No production/runtime code is touched.

Security risks

None. This is test-infrastructure reorganization only. The offline-registry pattern (http://localhost:1/) and per-project BUN_INSTALL_CACHE_DIR are carried over unchanged, so hermeticity is preserved. No new network access, no credential handling, no changes to src/.

Level of scrutiny

Low. The change is mechanical: every removed line reappears identically in one of the two new files, the describe path is preserved so snapshot keys resolve without regeneration, and import.meta.dir points to the same directory in the new harness file as it did in the original. The remaining imports in migrate.test.ts (bunEnv, bunExe, pack, tempDir, tmpdirSync) are still used by the ~1700 lines of tests that stay behind. I confirmed against test/parallel-allowlist.json that the new file will be picked up by the parallel batch as the PR claims.

Other factors

The 5-minute setDefaultTimeout and sequential test.each are pre-existing behavior being moved, not introduced here (the in-code comment already explains snapshot matchers don't work in concurrent groups). REVIEW.md's guidance against creating new test files doesn't apply — this is an intentional split for CI parallelism with a stated runtime justification, and the PR description documents local verification (57 pass / 57 snapshots, none written) plus merge-tree conflict analysis against open PRs. No outstanding reviewer objections in the timeline.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: aeb198b5-5a60-4e60-bb2e-9cfae14b7d54

📥 Commits

Reviewing files that changed from the base of the PR and between a6c4cc2 and 710d099.

⛔ Files ignored due to path filters (1)
  • test/cli/install/migration/__snapshots__/npm-arborist.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (3)
  • test/cli/install/migration/migrate.test.ts
  • test/cli/install/migration/migration-harness.ts
  • test/cli/install/migration/npm-arborist.test.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 6 remain after this review.


Walkthrough

The pull request extracts npm-arborist fixture and command utilities into a shared migration harness, adds a dedicated fixture migration snapshot suite, and removes the duplicated infrastructure from migrate.test.ts.

Changes

Migration test coverage

Layer / File(s) Summary
Shared fixture and command harness
test/cli/install/migration/migration-harness.ts
The harness creates disposable fixtures, writes offline registry settings and extra files, runs Bun with isolated caches, and parses bun.lock.
Dedicated arborist migration snapshots
test/cli/install/migration/npm-arborist.test.ts
The new suite migrates each npm-arborist fixture, records normalized output and exit status, and validates frozen-lockfile installation on success.
Migration test suite cleanup
test/cli/install/migration/migrate.test.ts
The existing suite removes duplicated fixture setup, command helpers, imports, and the former arborist snapshot group.

Merge Risk: ⚪ Minimal · up to 710d0

This change reorganizes existing migration tests and shared helpers without changing test behavior; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly states that the Arborist fixture cases moved out of migrate.test.ts. It accurately summarizes the primary change.
Description check ✅ Passed The description explains the problem, fix, verification steps, test results, and relevant background. It does not use the exact template headings, but it provides the required information in equivalen…
Full details: Description check

Explanation

The description explains the problem, fix, verification steps, test results, and relevant background. It does not use the exact template headings, but it provides the required information in equivalent sections.


Comment @coderabbitai help to get the list of available commands.

@robobun

robobun commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator Author
Updated 10:21 AM PT - Aug 30th, 2026

@robobun, your commit befd6a7 is building: #108584

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant