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(worker): do not swallow errors when sending custom messages #10984

Merged
merged 1 commit into from
Dec 28, 2020

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Dec 28, 2020

Summary

Extracted from #10981.

Test plan

Error from the reproduction of #10577 changes from

  ● Test suite failed to run

    "messageParent" can only be used inside a worker

      at messageParent (packages/jest-worker/build/workers/messageParent.js:46:11)

to

  ● Test suite failed to run

    TypeError: Converting circular structure to JSON
        --> starting at object with constructor 'Object'
        --- property 'ref' closes the circle
        at stringify (<anonymous>)

      at messageParent (packages/jest-worker/build/workers/messageParent.js:42:19)

When using jest-circus which makes use of this function

@@ -7,31 +7,33 @@

import {PARENT_MESSAGE_CUSTOM} from '../types';

const isWorkerThread = () => {
const isWorkerThread: boolean = (() => {
Copy link
Member Author

Choose a reason for hiding this comment

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

only run this once instead of on each invocation of the messageParent function


const messageParent = (
export default function messageParent(
Copy link
Member Author

Choose a reason for hiding this comment

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

should ignore whitespace here - diff is removed try-catch and added type information

https://github.com/facebook/jest/pull/10984/files?w=1

@SimenB SimenB merged commit 0c75d62 into jestjs:master Dec 28, 2020
@SimenB SimenB deleted the worker-message-parent-error branch December 28, 2020 15:21
@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 10, 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.

3 participants