Skip to content

Commit

Permalink
fix: ignore all unrelated messages from child process
Browse files Browse the repository at this point in the history
  • Loading branch information
LinusU committed Oct 31, 2022
1 parent 75eead0 commit 2048b4b
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions packages/jest-worker/src/workers/ChildProcessWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,16 +255,8 @@ export default class ChildProcessWorker
}

private _onMessage(response: ParentMessage) {
// Ignore messages emitted by @esbuild-kit/esm-loader
// ref: https://github.com/esbuild-kit/esm-loader/issues/43
if (
typeof response === 'object' &&
'type' in response &&
typeof (response as any).type === 'string' &&
(response as any).type === 'dependency' &&
'path' in response &&
typeof (response as any).path === 'string'
) {
// Ignore messages not intended for us
if (!Array.isArray(response)) {
return;
}

Expand Down Expand Up @@ -322,9 +314,6 @@ export default class ChildProcessWorker

this._performRestartIfRequired();
break;

default:
throw new TypeError(`Unexpected response from worker: ${response[0]}`);
}
}

Expand Down

0 comments on commit 2048b4b

Please sign in to comment.