Skip to content

Commit

Permalink
Override "process.send" with a mock (#5904)
Browse files Browse the repository at this point in the history
When creating a mock object for `process`, `process.send` is just referenced from the parent context, which means that a test has access to the real IPC channel established by `jest-worker`, thus breaking the sandbox.

As per the Node definition, `process.send` is not defined if the Node process hasn't started off a `fork` call; but this shouldn't be an issue because `send` has always been exposed and no one complained so far 🙃
  • Loading branch information
mjesun authored Mar 30, 2018
1 parent 0d31e9d commit 10b50c4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/jest-util/src/create_process_object.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export default function() {
}

newProcess.env = createProcessEnv();
newProcess.send = () => {};

return newProcess;
}

0 comments on commit 10b50c4

Please sign in to comment.