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
toHaveBeenCalledWith does no longer work with custom matcher #536
Comments
This is intended behavior. Things were muddied and poorly documented in 1.x in this area. We're now making it much more explicit and easier to maintain. It looks like there are two parts to your question. First, However, what you appear to be wanting to do is check that the specific reference is used. This sounds like you want to write a custom matcher that would be named something like Does this help? If so, I'd like to close this issue. |
Thank you for the timely response. I did not know about custom equality testers. I think with those I can re-create the pattern I need. Also, in the example the tester is added in "beforeEach". Would it suffice to add it only once at startup? |
It seems like custom equality testers do not work with tohaveBeenCalled with, which once again would prevent me for using it to test for identity? |
I'm also having the same issue. I have added a custom equality tester but it's not being picked up by toHaveBeenCalledWith. |
Just pushed a fix where custom equality testers weren't working with |
In Jasmine 1.3 you could use your custom matcher with toHaveBeenCalledWith, which was especially useful to ensure that the actual argument was identical to the expected one, not just equal. E.g.:
This is no longer possible with Jasmine 2.0, only 'any' and 'objectContaining' are accepted.
The text was updated successfully, but these errors were encountered: