Skip to content
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

fix(jest-worker): postMessage error handler in child threads #14437

Conversation

dj-stormtrooper
Copy link
Contributor

Summary

postMessage errors in threadChild is hard to investigate (for example DataCloneError errors), I added additional handler for this behavior in threadChild.ts.

This was a part of this PR, extracted for sooner merge

Test plan

Add this testcase to any testcase from the example directory, e.g. examples/typescript/__tests__/sum.test.js

it('should not explode', () => {
    const foo = () => {}
    const bar = () => {}
    expect(foo).toBe(bar)
})

Config:

// examples/typescript/package.json
 "jest": {
    "testEnvironment": "jsdom",
    "workerThreads": true,
    "maxWorkers": 1
  }

Command:

yarn test --watch

The result:

Before changes After changes
image image

@netlify
Copy link

netlify bot commented Aug 22, 2023

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit bbb4fc1
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/64e462dd2b44480008882845
😎 Deploy Preview https://deploy-preview-14437--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

great, thanks!

@SimenB SimenB merged commit 834d9d6 into jestjs:main Aug 23, 2023
89 checks passed
@SimenB
Copy link
Member

SimenB commented Aug 24, 2023

https://github.com/jestjs/jest/releases/tag/v29.6.4

@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 Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants