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

Don't reject promises until mock functions are called #14

Merged
merged 1 commit into from
Feb 27, 2019
Merged

Don't reject promises until mock functions are called #14

merged 1 commit into from
Feb 27, 2019

Conversation

haines
Copy link
Contributor

@haines haines commented Feb 27, 2019

jest-when has the same issue as jestjs/jest#5721 (which was fixed in jestjs/jest#5720) - mockRejectedValue causes an error if the mock function is called asynchronously, because the returned promise was rejected immediately.

This PR changes mockRejectedValue[Once] to defer the promise rejection until the mock function is actually called.

@timkindberg timkindberg merged commit a78928e into timkindberg:master Feb 27, 2019
@timkindberg
Copy link
Owner

Thanks! v2.3.1

@haines haines deleted the defer-promise-rejection branch February 27, 2019 19:54
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