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: defer Promise.reject to avoid unhandled rejection error #8

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

mcous
Copy link
Owner

@mcous mcous commented Jan 10, 2024

Thanks for the report @BeniRupp! The unhandled rejection problem seemed to be caused by the act of creating a rejection via Promise.reject(error) when the user calls .thenReject(error). The fix was pretty simple: wait to create the rejection until it the spy is actually called.

I appreciate the test case in your issue! I incorporated it into the suite

Fixes #7

@mcous mcous merged commit b289297 into main Jan 10, 2024
22 checks passed
@mcous mcous deleted the fix-unhandled-rejection branch January 10, 2024 14:31
@BeniRupp
Copy link

Wow, awesome! 🤩 Thanks @mcous for the fast response! 🚀

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.

Test throws error if rejected mock is never called
2 participants