-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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鈥檒l 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. |
馃悰 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: