fix(test): skip --strip-types injection on Node 24+ to unblock vitest#1078
Conversation
Node 24 enables type stripping by default and removed --strip-types from the NODE_OPTIONS allowlist; vitest worker forks die at startup with "--strip-types is not allowed in NODE_OPTIONS" because the config unconditionally injected the flag for major>=23. Gate the injection to the 22.6+ / 23 window where the flag is both required and accepted, and pick --strip-types only on exactly Node 23 (Node 22 still needs --experimental-strip-types). docs check acknowledged: test-infra-only change; no language, feature, command, architecture, or roadmap surface affected.
|
Claude finished @carlos-alm's task —— View job Review Analysis CompleteTodo List:
Root Cause AnalysisProblem Being Solved: Node 24+ crashes Vitest workers because Why This Approach: The fix correctly identifies that Node 24 has type stripping enabled by default and no longer accepts the flag. The solution gates injection to the specific Node versions that need it (22.6+ and 23 only). This is the right approach - fixing the version detection logic rather than working around symptoms. Risk Assessment: Low risk. The change is surgical, well-documented, and addresses a legitimate platform compatibility issue. The logic correctly handles edge cases (existing flags, version ranges). Backlog Compliance
Code Quality AssessmentStrengths:
Technical Correctness:
Minor Observations:
Critical ConcernsNone. This is a clean platform compatibility fix that addresses a real blocking issue without compromising code quality or test integrity. Final Recommendation
This PR effectively unblocks local development on Node 24 while maintaining backward compatibility. The version detection logic is correct and the approach is superior to workarounds or version pinning. |
Greptile SummaryGates
Confidence Score: 5/5Safe to merge — the change is a minimal, well-scoped guard that prevents a startup crash on Node 24 without touching any other behavior. The old injection condition ( No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Read process.versions.node] --> B{major === 22 AND minor >= 6?}
B -- Yes --> C[needsStripFlag = true, stripFlag = --experimental-strip-types]
B -- No --> D{major === 23?}
D -- Yes --> E[needsStripFlag = true, stripFlag = --strip-types]
D -- No --> F[needsStripFlag = false, Node lt 22.6 or Node 24+]
C --> G{Flag already in existing NODE_OPTIONS?}
E --> G
G -- No --> H[Inject stripFlag into NODE_OPTIONS]
G -- Yes --> I[Leave NODE_OPTIONS unchanged]
F --> I
Reviews (1): Last reviewed commit: "fix(test): skip --strip-types injection ..." | Re-trigger Greptile |
Summary
--strip-types is not allowed in NODE_OPTIONS.--strip-typesfrom the NODE_OPTIONS allowlist; the config was unconditionally injecting it formajor>=23.--strip-typesonly on exactly Node 23 — Node 22 still needs--experimental-strip-types.Why now
Blocks local verification of any other PR on a Node 24 machine. CI is pinned to Node 22 in
ci.ymlso this hasn't surfaced there, but anyone on a recent Homebrew install hits it immediately.Test plan
npx vitest run tests/builder/detect-changes.test.ts— passes on Node 24.10