Skip to content

Conversation

@mjesun
Copy link
Contributor

@mjesun mjesun commented Oct 4, 2017

This PR moves the coverage workers into the new jest-worker module; which also allows to use typed arguments and results on both sides. Tests were updated to match the new APIs.

@mjesun
Copy link
Contributor Author

mjesun commented Oct 4, 2017

I would also like to get more information on the disconnect listener, that I had to remove, now that the code is async/await and the promise will return at the end of the function no matter what you do.

It looks like this was added to avoid a possible race condition if the parent dies; if that's the case, I think the best alternative here is to add this if into the jest-worker method itself, and let the infrastructure deal with it, instead of having it on the client code. Thoughts?

@cpojer
Copy link
Member

cpojer commented Oct 4, 2017

This is not the coverage worker (in jest-cli), this is jest-runner… :O

@SimenB
Copy link
Member

SimenB commented Oct 8, 2017

The test failure seems ok (something that was null is now undefined), care to fix it so we get those nice green checkmarks? 🙂

rawModuleMap: watcher.isWatchMode()
? test.context.moduleMap.getRawModuleMap()
: null,
: undefined,
Copy link
Member

Choose a reason for hiding this comment

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

this is causing the single test failure

},
TEST_WORKER_PATH,
);
// $FlowFixMe: "default" property will be exposed.
Copy link
Member

Choose a reason for hiding this comment

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

It would be cool if default (as long as __esModule: true) would be the actual default export instead of attached to the default key (so you could just do worker(stuff)).

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 have been thinking about this, and I'm happy to see feedback on that direction. The reason of the default comes from the fact that a class instance is returned from new. The change here would be to make constructor return a method, but then instanceof JestWorker wouldn't work.

I will think more about it and see what's the best way of fixing the issue; but generally speaking, I agree with your comment.

} catch (error) {
callback(formatError(error));
} catch (err) {
throw formatError(err);
Copy link
Member

Choose a reason for hiding this comment

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

any particular reason formatError return something not an actual error? I realise that is not new in this PR, it just struck me as odd

@cpojer
Copy link
Member

cpojer commented Oct 9, 2017

Are you not going to acknowledge that this PR is converting a different piece of code than it says in the title? :P

I'm hesitant to merge this because it runs user tests which may fail, and currently there is no retry or throw/fail/exit strategy in jest-worker like we discussed last week. I'm more happy to merge this for the coverage worker, because that one runs code from a more controlled environment.

@mjesun
Copy link
Contributor Author

mjesun commented Oct 9, 2017

Yes, it's true; that's not the right piece of code we were initially intended to transform; however the PR itself is still valid; so I will keep it parked while we fix the retry issue on jest-worker. That said, it also gave useful feedback (see @SimenB's comment above) so it was still good to PR this :)

@cpojer
Copy link
Member

cpojer commented Oct 9, 2017

Yea, not saying anything is wrong with this PR, just adding context :)

@cpojer
Copy link
Member

cpojer commented Nov 2, 2017

See #4825

@cpojer cpojer closed this Nov 2, 2017
@mjesun mjesun deleted the move-coverage-farm-to-jest-worker branch November 2, 2017 14:23
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants