New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(jest-runner): switch workers to advanced serialization #14030
Conversation
Hi @alex3d! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
cc @SimenB I've added basic worker result sanitization to pass https://github.com/facebook/jest/blob/b38d7d345a81d97d1dc3b68b8458b1837fbf19be/e2e/__tests__/complexItemsInErrors.ts#L31 |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
It is worth to consider landing the sanitizeTestResult()
function separately, because it is fixing one of the bugs I have hit while using workerThreads
worker.
@@ -85,14 +85,31 @@ const sendMessageToJest: TestFileEvent = (eventName, args) => { | |||
messageParent([eventName, args]); | |||
}; | |||
|
|||
const sanitizeTestResult = (result: TestResult) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better add it as a function
:
const sanitizeTestResult = (result: TestResult) => { | |
function sanitizeTestResult(result: TestResult) { |
By the way, I was testing this branch locally. In the Node docs it is mentioned that structure clone algorithm:
How to understand this? Does it mean that extra properties set on an |
Yeah, node docs are right: extra properties of
Should I open new PR? |
The output in console was similar to "handles functions that close over outside variables" test. It was appearing while I was refactoring code base with huge objects, but leaving some mistakes in tests. In a way tests were supposed to fail, only the message was odd. Since object were huge, I did not manage to reproduce the error so far. Not sure about separate PR. Let’s wait for maintainer’s feedback. |
This PR is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 30 days. |
This PR was closed because it has been stalled for 30 days with no activity. Please open a new PR if the issue is still relevant, linking to this one. |
This PR was closed because it has been stalled for 30 days with no activity. Please open a new PR if the issue is still relevant, linking to this one. |
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. |
Summary
PR would switch workers from current JSON serialization to advanced (structuredClone) serialization.
This would fix problems with BigInt(#11617), circular references (#10577) and probably some other problems.
Test plan
Enable already existing BigInt test in
e2e/__tests__/complexItemsInErrors.ts
and test ine2e/__tests__/circularInequality.test.ts