-
-
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
toMatchObject seems to ignore Map and Set #11250
Comments
May be related to #11112 -- RegExp objects also have the same effect as Map in this case. |
Just got into this as well. The fact that it silently accepts the value and passes the test is error-prone. |
Fixed the REPL to make it clearer. I started experimenting with regexes shortly after I posted this issue, but then I didn't revert my changes :) |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
I've updated the reproduction REPL to use Jest 29.4.3, and can still reproduce this issue. |
I've just ran into this issue when trying to use This issue describes the problem: #13968, but is unfortunately already closed. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
Is it possible to reopen ? Unless it's been fixed |
I can't reopen it, and I don't really feel like trying to repro again with the newest version. |
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. |
🐛 Bug Report
I've noticed that
.toMatchObject
ignores any Map and Set objects, silently accepting different things.To Reproduce
Steps to reproduce the behavior:
Attempt to match an object against a Map or Set, for example:
Expected behavior
The test should fail, because Map and Set are always different from strings and arrays.
Link to repl or repo (highly encouraged)
https://replit.com/@fabiosantoscode/jest-playground#matchobject.test.js
envinfo
(and also in the REPL, which has this envinfo)
The text was updated successfully, but these errors were encountered: