From ff90e0842ce38e141a174842c1a3013f84000b84 Mon Sep 17 00:00:00 2001 From: Simen Bekkhus Date: Mon, 28 Dec 2020 20:30:22 +0100 Subject: [PATCH] fix: use advanced serialization when spawning jest workers --- CHANGELOG.md | 1 + packages/jest-runner/src/index.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b605adb268c1..a153fe514ec7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,6 +41,7 @@ - `[jest-reporter]` Handle empty files when reporting code coverage with V8 ([#10819](https://github.com/facebook/jest/pull/10819)) - `[jest-resolve]` Replace read-pkg-up with escalade package ([#10781](https://github.com/facebook/jest/pull/10781)) - `[jest-resolve]` Disable `jest-pnp-resolver` for Yarn 2 ([#10847](https://github.com/facebook/jest/pull/10847)) +- `[jest-runner]` Use advanced serialization when using workers ([#10644](https://github.com/facebook/jest/pull/10644)) - `[jest-runtime]` [**BREAKING**] Do not inject `global` variable into module wrapper ([#10644](https://github.com/facebook/jest/pull/10644)) - `[jest-runtime]` [**BREAKING**] remove long-deprecated `jest.addMatchers`, `jest.resetModuleRegistry`, and `jest.runTimersToTime` ([#9853](https://github.com/facebook/jest/pull/9853)) - `[jest-runtime]` Fix stack overflow and promise deadlock when importing mutual dependant ES module ([#10892](https://github.com/facebook/jest/pull/10892)) diff --git a/packages/jest-runner/src/index.ts b/packages/jest-runner/src/index.ts index acc8139e1eec..4b8f73f40b5a 100644 --- a/packages/jest-runner/src/index.ts +++ b/packages/jest-runner/src/index.ts @@ -166,7 +166,12 @@ export default class TestRunner { const worker = new Worker(TEST_WORKER_PATH, { exposedMethods: ['worker'], - forkOptions: {stdio: 'pipe'}, + forkOptions: { + // default to advanced serialization in order to match worker threads + // @ts-expect-error: option does not exist on the node 10 types + serialization: 'advanced', + stdio: 'pipe', + }, maxRetries: 3, numWorkers: this._globalConfig.maxWorkers, setupArgs: [