Skip to content

fix(bridge): instanceof Promise was not giving correct results when run with Jest #1737

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

Merged
merged 1 commit into from
Jul 3, 2025

Conversation

mjameswh
Copy link
Contributor

@mjameswh mjameswh commented Jul 3, 2025

What was changed

  • Bridge's error conversion logic now uses the isPromise node's utility function instead of an instanceof Promise check.

    The later is prone to Jest's globals differ from Node globals bug (i.e. somePromise instanceof Promise may evaluate to false in some contexts), which would result in not converting errors thrown from the Rust side when Worker is run in Jest.

    This has been causing Jest tests to fail with ShutdownError: Worker has been shutdown errors, using TS SDK 1.12.0.

@mjameswh mjameswh requested a review from a team as a code owner July 3, 2025 16:30
@mjameswh mjameswh merged commit 0b93a9a into main Jul 3, 2025
43 of 44 checks passed
@mjameswh mjameswh deleted the fix-jest-instanceof-promise branch July 3, 2025 21:15
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.

2 participants