diff --git a/CHANGELOG.md b/CHANGELOG.md index 3ca7f7a06dde..0098e4f7d9e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ ### Fixes +- `[jest-worker]` Filter `execArgv` correctly ([#12097](https://github.com/facebook/jest/pull/12097)) + ### Chore & Maintenance ### Performance @@ -27,6 +29,7 @@ - `[jest-environment-jsdom]` Add `@types/jsdom` dependency ([#11999](https://github.com/facebook/jest/pull/11999)) - `[jest-environment-jsdom]` Do not reset the global.document too early on teardown ([#11871](https://github.com/facebook/jest/pull/11871)) - `[jest-transform]` Improve error and warning messages ([#11998](https://github.com/facebook/jest/pull/11998)) +- `[jest-worker]` Pass `execArgv` correctly to `worker_threads` worker ([#12069](https://github.com/facebook/jest/pull/12069)) ### Chore & Maintenance diff --git a/packages/jest-worker/src/workers/NodeThreadsWorker.ts b/packages/jest-worker/src/workers/NodeThreadsWorker.ts index da6c3741b6b0..70551119b04b 100644 --- a/packages/jest-worker/src/workers/NodeThreadsWorker.ts +++ b/packages/jest-worker/src/workers/NodeThreadsWorker.ts @@ -65,7 +65,10 @@ export default class ExperimentalWorker implements WorkerInterface { JEST_WORKER_ID: String(this._options.workerId + 1), // 0-indexed workerId, 1-indexed JEST_WORKER_ID }, eval: false, - execArgv: process.execArgv, + // Suppress --max_old_space_size flags while preserving others (like --harmony). See https://nodejs.org/api/worker_threads.html#new-workerfilename-options + execArgv: process.execArgv.filter( + v => !/^--(max_old_space_size)/.test(v), + ), // @ts-expect-error: added in newer versions resourceLimits: this._options.resourceLimits, stderr: true,