From d7086106c6bc05ddc39cea337fd1852594769866 Mon Sep 17 00:00:00 2001 From: carlos-alm Date: Mon, 18 May 2026 22:48:28 -0600 Subject: [PATCH] fix(test): use --experimental-strip-types in Worker execArgv MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The snapshot concurrent-save tests passed `--strip-types` to Worker execArgv on Node ≥ 23. That flag is not in the Worker execArgv allowlist on Node 24, so both workers exited with ERR_WORKER_INVALID_EXEC_ARGV before posting a message, causing Promise.allSettled to return two rejected entries and the test assertions to fail. `--experimental-strip-types` is accepted as a Worker execArgv flag on all supported Node versions (≥ 22.6) and is a harmless no-op on Node ≥ 23.6 where type stripping is default-on. Closes #1117 --- tests/unit/snapshot.test.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/unit/snapshot.test.ts b/tests/unit/snapshot.test.ts index a532b62fa..ea4651cdc 100644 --- a/tests/unit/snapshot.test.ts +++ b/tests/unit/snapshot.test.ts @@ -149,16 +149,16 @@ describe('snapshotSave', () => { // snapshotSave. better-sqlite3 is synchronous, so Promise-based // concurrency would queue two sequential microtasks — only separate // threads exercise the TOCTOU race. - const nodeMajor = Number(process.versions.node.split('.')[0]); const raceWorkerPath = path.join(__dirname, 'snapshot-race-worker.mjs'); // --import requires a URL (file://…) or a bare/relative specifier, not a // drive-letter path on Windows. Use the file:// URL directly. const loaderUrl = new URL('../../scripts/ts-resolve-loader.js', import.meta.url).href; - const raceExecArgv = [ - nodeMajor >= 23 ? '--strip-types' : '--experimental-strip-types', - '--import', - loaderUrl, - ]; + // `--experimental-strip-types` is accepted by Worker execArgv across all + // supported Node versions (≥ 22.6); the unprefixed `--strip-types` flag + // is not in the Worker allowlist on Node 24 and causes + // ERR_WORKER_INVALID_EXEC_ARGV. On Node ≥ 23.6 type stripping is on by + // default, so the flag is a harmless no-op there. + const raceExecArgv = ['--experimental-strip-types', '--import', loaderUrl]; const spawnSaveWorker = (workerData: { dbPath: string; name: string;