-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Make existing Jest matchers available in expect.extend #3139
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
Comments
See #2547. |
I ran across this issue looking for an equivalent to jasmine.objectContaining. I know there's an expect.objectContaining matcher, but I don't feel like I want to new that up and call asymmetricMatch on it to do an asymmetric object comparison (per the discussion on #2547). I don't want to make an expectation in my custom matcher; I just want to test whether the expected properties are among the actual properties. But then I saw that jasmine is in the global scope . . . (which is why I think this comment is relevant on this issue rather than the other). What is the relationship between Jest and Jasmine? Should we expect the jasmine object to continue to be available? Should I use jasmine.objectContaining in lieu of expect.objectContaining? |
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. |
Feature request: it would be really convenient to be able to build custom matchers on top of existing ones. In my project I really needed to use
expect(x).toEqual(y)
in my custom matcher. I was able to do this by usingjasmine.matchersUtil.equals
. However, this is not documented anywhere in Jest docs. Is this the intended way? Or should we add this tothis.utils
?What is the current behavior?
To to use
toEqual
matcher inexpect.extend
, one needs to calljasmine.matchersUtil.equals
.What is the expected behavior?
The user should be able to do something like
this.utils.equals
and this has to be documented. If thejasmine.matchersUtil
is actually the intended behaviour, it needs to be documented inexpect.extend
section.The text was updated successfully, but these errors were encountered: