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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Asymmetric matcher Object does not implement toAsymmetricMatcher() #13134

Closed
bjoluc opened this issue Aug 14, 2022 · 6 comments · Fixed by #13263 or #14025
Closed

[Bug]: Asymmetric matcher Object does not implement toAsymmetricMatcher() #13134

bjoluc opened this issue Aug 14, 2022 · 6 comments · Fixed by #13263 or #14025
Labels

Comments

@bjoluc
Copy link

bjoluc commented Aug 14, 2022

Version

28.1.3

Steps to reproduce

Expected behavior

I expect My test case to pass and to write a snapshot.

Actual behavior

My test case fails with Asymmetric matcher Object does not implement toAsymmetricMatcher() and does not write a snapshot.

Additional context

No response

Environment

System:
  OS: Linux 5.4 Ubuntu 20.04.2 LTS (Focal Fossa)
  CPU: (8) x64
Binaries:
  Node: 16.16.0 - /usr/bin/node
  Yarn: 1.22.18 - /usr/bin/yarn
  npm: 8.15.0 - /usr/bin/npm
npmPackages:
  jest: ^28.1.3 => 28.1.3
@bjoluc
Copy link
Author

bjoluc commented Aug 14, 2022

I guess this was introduced by #12626

@github-actions
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

@SimenB
Copy link
Member

SimenB commented Sep 14, 2022

@bjoluc The error is very misleading - the issue is that you cannot pass an array to toMatchSnapshot. I've added a check for this so it fails earlier

@bjoluc
Copy link
Author

bjoluc commented Sep 30, 2022

Thanks for the clarification @SimenB! I was confused since this used to work in Jest v27. Is there any better workaround than nesting the array in an object? 😄

@SimenB
Copy link
Member

SimenB commented Sep 30, 2022

Not really - it's made for objects, not really an array of them... Could you open up a feature request for supporting arrays?

@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 Oct 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
2 participants