Context
#7619 wired scripts/check-node-version.mjs as a pretest* hook on 5 npm script names (test,
test:ci, test:coverage, test:workers, ui:test). A repo-wide audit after it shipped found this
misses 8 of the 12 vitest-invoking script names in root package.json (test:unit, test:integration,
test:upstream-contract, test:engine-parity, test:live-gate-parity, test:driver-parity,
test:changed, test:watch) -- npm's pre<name> hook only fires for the exact script name it's wired
to. Worse: this class of mechanism can never cover a direct npx vitest run test/unit/<file>.test.ts
invocation, which .claude/skills/contributing-to-loopover/reference.md and SKILL.md both explicitly
recommend for fast iteration while writing tests -- that command doesn't go through any npm script at
all, so no number of pretest* entries closes the gap.
Requirements
- Add a vitest
globalSetup (test/helpers/vitest-global-setup-node-version.ts, reusing
checkNodeVersion from scripts/check-node-version.mjs) that runs once before any test file,
regardless of invocation path.
- Wire it into every
vitest.config.ts in the repo: root, vitest.workers.config.ts, and every
workspace with its own config (apps/loopover-ui, apps/loopover-miner-ui,
packages/loopover-ui-kit, apps/loopover-miner-extension).
- Keep the existing
pretest* hooks as a genuinely-faster fail for the 5 high-traffic commands (they run
before npm even spawns vitest); update check-node-version.mjs's own header comment so it accurately
describes globalSetup as the real guarantee and the hooks as a nicety on top, not a substitute.
Deliverables
Test Coverage Requirements
The new helper and every touched vitest config live outside Codecov's src/**-only include glob, so
this owes no patch-coverage number. Verified via direct reproduction on Node 26 instead (see Deliverables).
Expected Outcome
Every vitest invocation path -- any current or future npm script name, and any direct npx vitest call
-- fails immediately and clearly on the wrong Node version, with no gap requiring anyone to remember to
wire a new pretest* entry.
Links & Resources
Context
#7619 wired
scripts/check-node-version.mjsas apretest*hook on 5 npm script names (test,test:ci,test:coverage,test:workers,ui:test). A repo-wide audit after it shipped found thismisses 8 of the 12 vitest-invoking script names in root
package.json(test:unit,test:integration,test:upstream-contract,test:engine-parity,test:live-gate-parity,test:driver-parity,test:changed,test:watch) -- npm'spre<name>hook only fires for the exact script name it's wiredto. Worse: this class of mechanism can never cover a direct
npx vitest run test/unit/<file>.test.tsinvocation, which
.claude/skills/contributing-to-loopover/reference.mdandSKILL.mdboth explicitlyrecommend for fast iteration while writing tests -- that command doesn't go through any npm script at
all, so no number of
pretest*entries closes the gap.Requirements
globalSetup(test/helpers/vitest-global-setup-node-version.ts, reusingcheckNodeVersionfromscripts/check-node-version.mjs) that runs once before any test file,regardless of invocation path.
vitest.config.tsin the repo: root,vitest.workers.config.ts, and everyworkspace with its own config (
apps/loopover-ui,apps/loopover-miner-ui,packages/loopover-ui-kit,apps/loopover-miner-extension).pretest*hooks as a genuinely-faster fail for the 5 high-traffic commands (they runbefore npm even spawns vitest); update
check-node-version.mjs's own header comment so it accuratelydescribes globalSetup as the real guarantee and the hooks as a nicety on top, not a substitute.
Deliverables
test/helpers/vitest-global-setup-node-version.tsadded.globalSetupwired into all 6 vitest configs.npx vitest run <file>on Node 26 now failsimmediately via globalSetup, both at the root and inside
apps/loopover-ui.npm run test:cigreen on Node 22..claude/skills/contributing-to-loopover/reference.mddocuments the globalSetup mechanism.Test Coverage Requirements
The new helper and every touched vitest config live outside Codecov's
src/**-only include glob, sothis owes no patch-coverage number. Verified via direct reproduction on Node 26 instead (see Deliverables).
Expected Outcome
Every vitest invocation path -- any current or future npm script name, and any direct
npx vitestcall-- fails immediately and clearly on the wrong Node version, with no gap requiring anyone to remember to
wire a new
pretest*entry.Links & Resources
pretest*-only fix this closes the gap in