From 8855d11504300f7ea5268c14b4b36c909b4768e8 Mon Sep 17 00:00:00 2001 From: carlos-alm Date: Thu, 7 May 2026 18:56:56 -0600 Subject: [PATCH] fix(test): skip --strip-types injection on Node 24+ to unblock vitest 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. --- vitest.config.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/vitest.config.ts b/vitest.config.ts index 0eede49ac..c78f12ae3 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -2,8 +2,12 @@ import { defineConfig } from 'vitest/config'; const [major, minor] = process.versions.node.split('.').map(Number); const existing = process.env.NODE_OPTIONS || ''; -const supportsStripTypes = major > 22 || (major === 22 && minor >= 6); -const stripFlag = major >= 23 ? '--strip-types' : '--experimental-strip-types'; +// Node 24+ has type stripping on by default and removed --strip-types from the +// NODE_OPTIONS allowlist, so injecting the flag is both unnecessary and fatal +// (workers refuse to start). Only inject for the Node 22.6+ / Node 23 window +// where the flag is required and accepted. +const needsStripFlag = (major === 22 && minor >= 6) || major === 23; +const stripFlag = major === 23 ? '--strip-types' : '--experimental-strip-types'; export default defineConfig({ resolve: { @@ -19,7 +23,7 @@ export default defineConfig({ env: { NODE_OPTIONS: [ existing, - supportsStripTypes && !existing.includes('--experimental-strip-types') && !existing.includes('--strip-types') + needsStripFlag && !existing.includes('--experimental-strip-types') && !existing.includes('--strip-types') ? stripFlag : '', ].filter(Boolean).join(' '),