Skip to content

Commit

Permalink
fix(workers): use advanced serialization by default in child process …
Browse files Browse the repository at this point in the history
…workers
  • Loading branch information
SimenB committed Dec 28, 2020
1 parent e3d5491 commit d384694
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -19,6 +19,7 @@
- `[jest-runtime, jest-transform]` share `cacheFS` between runtime and transformer ([#10901](https://github.com/facebook/jest/pull/10901))
- `[jest-transform]` Pass config options defined in Jest's config to transformer's `process` and `getCacheKey` functions ([#10926](https://github.com/facebook/jest/pull/10926))
- `[jest-worker]` Add support for custom task queues and adds a `PriorityQueue` implementation. ([#10921](https://github.com/facebook/jest/pull/10921))
- `[jest-worker]` [**BREAKING**] Default to advanced serialization when using child process workers ([#10983] (https://github.com/facebook/jest/pull/10983))

### Fixes

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-worker/README.md
Expand Up @@ -69,7 +69,7 @@ Maximum amount of times that a dead child can be re-spawned, per call. Defaults

#### `forkOptions: Object` (optional)

Allow customizing all options passed to `childProcess.fork`. By default, some values are set (`cwd`, `env` and `execArgv`), but you can override them and customize the rest. For a list of valid values, check [the Node documentation](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options).
Allow customizing all options passed to `childProcess.fork`. By default, some values are set (`cwd`, `env`, `execArgv` and `serialization`), but you can override them and customize the rest. For a list of valid values, check [the Node documentation](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options).

#### `computeWorkerKey: (method: string, ...args: Array<any>) => ?string` (optional)

Expand Down
3 changes: 3 additions & 0 deletions packages/jest-worker/src/workers/ChildProcessWorker.ts
Expand Up @@ -92,6 +92,9 @@ export default class ChildProcessWorker implements WorkerInterface {
} as NodeJS.ProcessEnv,
// Suppress --debug / --inspect flags while preserving others (like --harmony).
execArgv: process.execArgv.filter(v => !/^--(debug|inspect)/.test(v)),
// default to advanced serialization in order to match worker threads
// @ts-expect-error: option does not exist on the node 10 types
serialization: 'advanced',
silent: true,
...this._options.forkOptions,
});
Expand Down
Expand Up @@ -70,6 +70,7 @@ it('passes fork options down to child_process.fork, adding the defaults', () =>
env: {...process.env, FORCE_COLOR: supportsColor.stdout ? '1' : undefined}, // Default option.
execArgv: ['-p'], // Filtered option.
execPath: 'hello', // Added option.
serialization: 'advanced', // Default option.
silent: true, // Default option.
});
});
Expand Down

0 comments on commit d384694

Please sign in to comment.