-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
UnhandledPromiseRejectionWarning: Unhandled promise rejection #3097
Comments
I guess calling "reject" on the Promise class itself is not recommended anymore, but I'm not sure why. |
@JimTheMan , if that's the case, then it would be nice to give an example on how to 'mock' a rejection, if that's the thing you need to test... In most cases, having the error is good, because 99% of the time, it's because a return was forgotten, but in the example given (which I also have now encountered), the EDIT: I solved this by doing the following (if others also encounter this problem)
For the modal, the promise is still rejected, and so we can test what happens upon that still. |
Why was this closed? I get this issue in the latest version of mocha 5.2.0 |
+1 @jwickens , I'm seeing this problem as well. |
Maybe it will help somebody, I had the same issue, but because of my own subtle bug: In a test I forgot to |
@d4nyll Can you tell us why this was closed, please? |
When I run tests on functions that returns a rejected promise, the test passes but an
UnhandledPromiseRejectionWarning: Unhandled promise rejection
is outputted to the console.It produces the following output:
I have created a repository at to repreduce this issue.
I believe this will be fixed with #2640 and a similar issue was filed at #2797, but this repository provides an easy, minimalistic way to reproduce the issue.
The text was updated successfully, but these errors were encountered: