diff --git a/CHANGELOG.md b/CHANGELOG.md index 494e36427afb..6a6bafc368ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Fixes - `[jest-mock]` Treat cjs modules as objects so they can be mocked ([#13513](https://github.com/facebook/jest/pull/13513)) +- `[jest-worker]` Ignore IPC messages not intended for Jest ([#13543](https://github.com/facebook/jest/pull/13543)) ### Chore & Maintenance diff --git a/packages/jest-worker/src/workers/ChildProcessWorker.ts b/packages/jest-worker/src/workers/ChildProcessWorker.ts index e3999fa49e1a..f9652edd2b2d 100644 --- a/packages/jest-worker/src/workers/ChildProcessWorker.ts +++ b/packages/jest-worker/src/workers/ChildProcessWorker.ts @@ -255,6 +255,9 @@ export default class ChildProcessWorker } private _onMessage(response: ParentMessage) { + // Ignore messages not intended for us + if (!Array.isArray(response)) return; + // TODO: Add appropriate type check let error: any; @@ -311,7 +314,8 @@ export default class ChildProcessWorker break; default: - throw new TypeError(`Unexpected response from worker: ${response[0]}`); + // Ignore messages not intended for us + break; } }