Skip to content

Commit

Permalink
fix: ignore IPC messages not intended for Jest
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed Oct 31, 2022
1 parent 54ce105 commit 27fc514
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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

- `[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

Expand Down
6 changes: 5 additions & 1 deletion packages/jest-worker/src/workers/ChildProcessWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 27fc514

Please sign in to comment.