Skip to content

Commit 0198c57

Browse files
authored
fix(test): use --experimental-strip-types in Worker execArgv (#1164)
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
1 parent 610c697 commit 0198c57

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tests/unit/snapshot.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,16 +149,16 @@ describe('snapshotSave', () => {
149149
// snapshotSave. better-sqlite3 is synchronous, so Promise-based
150150
// concurrency would queue two sequential microtasks — only separate
151151
// threads exercise the TOCTOU race.
152-
const nodeMajor = Number(process.versions.node.split('.')[0]);
153152
const raceWorkerPath = path.join(__dirname, 'snapshot-race-worker.mjs');
154153
// --import requires a URL (file://…) or a bare/relative specifier, not a
155154
// drive-letter path on Windows. Use the file:// URL directly.
156155
const loaderUrl = new URL('../../scripts/ts-resolve-loader.js', import.meta.url).href;
157-
const raceExecArgv = [
158-
nodeMajor >= 23 ? '--strip-types' : '--experimental-strip-types',
159-
'--import',
160-
loaderUrl,
161-
];
156+
// `--experimental-strip-types` is accepted by Worker execArgv across all
157+
// supported Node versions (≥ 22.6); the unprefixed `--strip-types` flag
158+
// is not in the Worker allowlist on Node 24 and causes
159+
// ERR_WORKER_INVALID_EXEC_ARGV. On Node ≥ 23.6 type stripping is on by
160+
// default, so the flag is a harmless no-op there.
161+
const raceExecArgv = ['--experimental-strip-types', '--import', loaderUrl];
162162
const spawnSaveWorker = (workerData: {
163163
dbPath: string;
164164
name: string;

0 commit comments

Comments
 (0)