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

fix(jest-matcher-utils): compare value of inherited getter on test failure (#10167) #14007

Merged
merged 3 commits into from
Mar 20, 2023

Conversation

BenceSzalai
Copy link
Contributor

@BenceSzalai BenceSzalai commented Mar 14, 2023

Summary

Inherited getters were not enumerated by deepCyclicCopyObject causing getters not being replaced with value and the test code to call those getters later on the copied object. If the non-replaced getter depended on other non-copied value, e.g. a private class field the calling code could end up in error while trying to show comparison of the expected and received value on test failures.
Fixes #10167

See more detailed analysis under the issue: #10167 (comment)

Test plan

Added a new test case 'copies value of inherited getters' which is failing without the fix but passes after.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, this LGTM 👍

could you fix the linting error?

@BenceSzalai
Copy link
Contributor Author

Sorry, missed that one. Hope it'll pass this time.

@SimenB SimenB merged commit 04f11d8 into jestjs:main Mar 20, 2023
@github-actions
Copy link

This pull request 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 20, 2023
@SimenB
Copy link
Member

SimenB commented Jul 4, 2023

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

toEqual throws a TypeError when using getter to private field of class
3 participants