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
fix: toHaveProperty with expect.any (fix: #1675) #1682
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope, you need to use equals
function (already imported as jestEquals
). It supports asymmetric matchers out of the box.
@sheremet-va Does vitest/test/core/test/jest-expect.test.ts Lines 199 to 205 in 7c2138f
|
|
Is there any method already used in vitest? like lodash.get? If not, can I use lodash? Or do I have to do my implementation? Sorry for all the questions 😅 |
I don't think we use it anywhere. You can check source code for this matcher in chai repo, maybe they have a public API for this things. |
@sheremet-va I refactored using |
I'm not sure I implemented the fix in the right place, but it seems to fix the problem in #1675.