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

Handle unhandledRejection and uncaughtException in workers. #4012

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

garg3133
Copy link
Member

@garg3133 garg3133 commented Feb 1, 2024

Right now, if there is ever an unhandledRejection or uncaughtException in a worker thread, it just exits along with the main thread and all the user sees is:
image

In such cases, the user gets no information on what went wrong and it is only after they run the tests serially that they get some information:
image

This PR resolves this by informing the main thread of any unhandledRejection or uncaughtException in the worker threads so that appropriate actions can be performed after that in the main thread, which otherwise just exits in case of such errors in the worker threads.

image

On a side note, it seems very weird to me that the main thread just goes poof! whenever there is an unhandledRejection in any of the worker threads and I tried to debug it but couldn't find the reason why this is happening.

Copy link

github-actions bot commented Feb 1, 2024

Status

  • ❌ No modified files found in the types directory.
    Please make sure to include types for any changes you have made. Thank you!.

@garg3133
Copy link
Member Author

garg3133 commented Feb 1, 2024

On further inspection, I found that the earlier solution was entirely correct and had a few shortcomings.

While an error was being displayed in the output box of the test corresponding to the failing worker thread, the error was not being considered in the final report because a report for that particular worker thread never made it to the main thread. This would have led testers to miss those error messages in large test environments and assume that their test suites passed while a few of the tests actually got skipped due to some error.

The current solution is more in line with how we handle such situations in --serial mode, where we exit the test run upon encountering any unhandledRejection or uncaughtException and inform the users about the failure at that instant only.

Handling in serial mode:

image

Handling in parallel mode (this PR):

image

@garg3133
Copy link
Member Author

garg3133 commented Feb 6, 2024

I need to add some tests here.

@garg3133 garg3133 marked this pull request as draft February 12, 2024 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant