-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Improve messaging for failed toHaveBeenCalledWith assertions #3523
Comments
Would you be interested in sending PR with the enhancement? :) |
I don't have time right now, just flagging it in case someone has interest.
…On Wed, May 10, 2017 at 1:38 PM Michał Pierzchała ***@***.***> wrote:
Would you be interested in sending PR with the enhancement? :)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#3523 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAiy1mpc2lSNZwzxY6DW7Lz3_F97SIcFks5r4fYlgaJpZM4NUhct>
.
|
I'd love to give it a try :) |
Hi! So I've been looking at the code for Here instead of Any ideas? How could I approach this? Thank you! UPDATE: Nevermind, got it, but the code is pretty ugly, I'll spend more tame later today improving it :) |
There's a lodash method called "partition" that might be good for this @rubenmoya |
I have a working version for this feature but before sending the PR, I wanted to clarify error messages. Should we only include the first failed argument from a single call? Or all failed argument assertions from all calls? Any ideas @thymikee? |
@mkubilayk let's ship the PR and we'll discuss on the real thing :). But I'd rather like to see all failed arguments from relevant calls. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Currently if you are using
expect(fn).toHaveBeenCalledWith(expect2, expect2)
perhaps like:Error output:
The resulting error message doesn't specify which argument lead to the failed assertion. It simply pretty-prints the mock call arguments and says something failed. This can be difficult to debug if those arguments are particularly large objects, etc.
It would be helpful to point out which argument(s) contributed to the assertion fail, like:
"Argument 1 did not satisfy the expectation expect.anything(), received undefined." or
"Argument 2 did not satisfy the expectation expect.objectContaining({fizz: 'buzz'}), received <CODE>."
The text was updated successfully, but these errors were encountered: