Skip to content
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

expect.any() does not match in toMatchObject if other keys mismatch #11765

Closed
dandv opened this issue Aug 18, 2021 · 5 comments
Closed

expect.any() does not match in toMatchObject if other keys mismatch #11765

dandv opened this issue Aug 18, 2021 · 5 comments

Comments

@dandv
Copy link
Contributor

dandv commented Aug 18, 2021

馃悰 Bug Report

When comparing two objects with toMatchObject, if a literal key differs, others keys are reported to not match expect.any(...) even if they do.

To Reproduce

image

Link to repl

https://replit.com/@dandv1/jest-bug-9298#bug9298.test.js

envinfo

  System:
    OS: Linux 5.4 undefined
    CPU: (8) x64 Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
  Binaries:
    Node: 16.2.0 - /usr/local/bin/node
    npm: 7.20.6 - /usr/local/bin/npm

Other info

Possibly related: #9298.

I'm also pretty sure someone else has filed this bug but I can't find it, and GitHub no longer shows similar issues when creating a new one.

@dandv
Copy link
Contributor Author

dandv commented Aug 18, 2021

Looks like #6184, but the bot locked that issue (thanks?) so I can't continue the discussion there.

@sigveio
Copy link
Contributor

sigveio commented Aug 24, 2021

Hey @dandv,

Which version of Jest are you running? (npx envinfo --preset jest)

Replit seems to be terribly outdated and running Node 12 and Jest 23. 馃槵

Everything looks a-ok here running your test on Jest 27.

Screenshot 2021-08-24 at 17 49 10

@github-actions
Copy link

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.

@github-actions github-actions bot added the Stale label Feb 17, 2023
@github-actions
Copy link

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.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2023
@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants