Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[jest-worker] Don't crash when running node with flags disallowed in workers #12128

Merged
merged 5 commits into from
Dec 10, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
### Fixes

- `[babel-jest]` Add `process.version` chunk to the cache key ([#12122](https://github.com/facebook/jest/pull/12122))
- `[jest-worker]` Stop explicitly passing `execArgv` ([#12128](https://github.com/facebook/jest/pull/12128))

### Chore & Maintenance

Expand Down
4 changes: 0 additions & 4 deletions packages/jest-worker/src/workers/NodeThreadsWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,6 @@ export default class ExperimentalWorker implements WorkerInterface {
JEST_WORKER_ID: String(this._options.workerId + 1), // 0-indexed workerId, 1-indexed JEST_WORKER_ID
},
eval: false,
// 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|max-old-space-size)/.test(v),
),
// @ts-expect-error: added in newer versions
resourceLimits: this._options.resourceLimits,
stderr: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,10 @@ afterEach(() => {
it('passes fork options down to worker_threads.Worker, adding the defaults', () => {
const thread = require.resolve('../threadChild');

process.execArgv = ['--inspect', '-p'];

// eslint-disable-next-line no-new
new Worker({
forkOptions: {
execArgv: ['--inspect', '-p'],
execPath: 'hello',
},
maxRetries: 3,
Expand Down