Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Modifying a bunch of types and adding $FlowFixMe because Flow.... 🤦🏻‍♂️
  • Loading branch information
Miguel Jimenez Esun committed Oct 3, 2017
commit 93452a24dea5b8936016224fd3b0df1da90689ea
3 changes: 2 additions & 1 deletion packages/jest-worker/src/child.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let file = null;
* If an invalid message is detected, the child will exit (by throwing) with a
* non-zero exit code.
*/
process.on('message', (request: ChildMessage) => {
process.on('message', (request: any) => { // Should be ChildMessage
switch (request[0]) {
case CHILD_MESSAGE_INITIALIZE:
file = request[2];
Expand Down Expand Up @@ -77,6 +77,7 @@ function reportError(error: Error) {
error.constructor && error.constructor.name,
error.message,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when a string is thrown? throw 'Foo'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just added a commit to allow this.

error.stack,
// $FlowFixMe: this is safe to just inherit from Object.
typeof error === 'object' ? Object.assign({}, error) : error,
]);
}
Expand Down
4 changes: 3 additions & 1 deletion packages/jest-worker/src/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export default class {
child.on('message', this._receive.bind(this));
child.on('exit', this._exit.bind(this));

// $FlowFixMe: wrong "ChildProcess.send" signature.
child.send([CHILD_MESSAGE_INITIALIZE, false, this._options.workerPath]);

this._child = child;
Expand Down Expand Up @@ -120,11 +121,12 @@ export default class {
call.request[1] = true;

this._busy = true;
// $FlowFixMe: wrong "ChildProcess.send" signature.
this._child.send(call.request);
}
}

_receive(response: ParentMessage) {
_receive(response: any) { // Should be ParentMessage
const callback = this._queue[0].callback;

this._busy = false;
Expand Down