test: add add_dist_tag bats helper for verdaccio storage#422
Conversation
Verdaccio re-reads package.json from disk per request, so mutating test/registry/storage/<pkg>/package.json is enough to flip a dist-tag mid-test without a registry restart. update.bats and ~9 other files need this pattern; factor it out so each caller doesn't reinvent the jq splice. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Greptile SummaryAdds Confidence Score: 5/5Safe to merge — test-only helper with correct temp-file handling and clear usage documentation. Single-file change adding a test helper; no production code touched. The No files require special attention. Important Files Changed
Reviews (2): Last reviewed commit: "test: clean up add_dist_tag tmp file on ..." | Re-trigger Greptile |
Empty .tmp files from a failed jq run aren't restored by the
git-checkout teardown pattern, so they'd linger as untracked junk
in the committed fixture. Guard the redirect with `|| { rm -f
"$tmp"; return 1; }`.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Benchmark changesVersions:
Public ratios: warm installs vs Bun 3x -> 4x; warm installs vs pnpm 9x -> 6x.
76b0262 vs b5cb3cd | aube/bun/pnpm | 3 scenarios | 3 runs | 500mbit/50ms | generated by Codex. |
## Summary - Check off Phase 0 — `@pnpm.e2e/*` fixtures ([#424](#424)) and `add_dist_tag` helper ([#422](#422)) both landed. - Record `lifecycleScripts.ts` 8/21 ported via [#421](#421) with a done/remaining split. - Relabel Phase 2 as unblocked (was "depends on add_dist_tag helper"). - Refresh the conventions note now that the `@pnpm.e2e/*` fixtures are in-tree. ## Test plan - [ ] doc-only — render check on GitHub 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Low Risk** > Documentation-only updates to the pnpm test-import tracking doc; no runtime or test behavior changes. > > **Overview** > Updates `test/PNPM_TEST_IMPORT.md` to mark Phase 0 infrastructure work as complete (mirrored `@pnpm.e2e/*` fixtures and the `add_dist_tag` helper), and records current Tier 1 progress for `lifecycleScripts.ts` (8/21 ported with done/remaining notes). > > Renames Phase 2 as *unblocked* now that `add_dist_tag` exists, and refreshes the translation conventions to prefer using the in-tree `@pnpm.e2e/*` fixtures when specific package shapes are required. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 270cfc9. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Summary
add_dist_tag <pkg> <tag> <version>totest/test_helper/common_setup.bash. It splices a dist-tag intotest/registry/storage/<pkg>/package.jsonviajq— Verdaccio re-reads from disk per request, so the new tag takes effect on the next resolve without a registry restart.update.bats); factoring it out avoids reinventing the samejqsplice in each caller.Notes for reviewers
git checkoutin teardown — same patterndeprecate.batsalready uses. The doc comment spells this out and points at that file.# bats file_tags=serial+BATS_NO_PARALLELIZE_WITHIN_FILE=1, matching the existing convention indeprecate.bats.Test plan
is-odd: addsnext: 0.1.2alongsidelatest: 3.0.1, thengit checkoutcleanly restores.test/test_helper/common_setup.bash(pre-commit ran clean locally).🤖 Generated with Claude Code
Note
Low Risk
Low risk since it only adds a test helper, but it mutates committed Verdaccio fixtures so incorrect cleanup could cause flaky or non-parallel-safe test runs.
Overview
Adds
add_dist_tag <pkg> <tag> <version>totest/test_helper/common_setup.bashto let BATS tests update a package’sdist-tagsdirectly in the committed Verdaccio storage viajq(taking effect on the next registry resolve).The helper writes via a temp file and documents required
git checkoutteardown cleanup plus serial/within-file non-parallel execution to avoid cross-test fixture races.Reviewed by Cursor Bugbot for commit 76b0262. Bugbot is set up for automated code reviews on this repo. Configure here.