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

toMatchObject fails if multiple keys in the expected object map to the same instance #9036

Closed
celerytea opened this issue Oct 10, 2019 · 2 comments
Assignees

Comments

@celerytea
Copy link

💥 Regression Report

This test

test('Test', () => {
  const leftCommon = {
    key: 'value',
    extra: 'extra',
  };
  const rightCommon = {
    key: 'value',
  };
  const left = {
    prop1: leftCommon,
    prop2: leftCommon,
  };
  const right = {
    prop1: rightCommon,
    prop2: rightCommon,
  };
  expect(left).toMatchObject(right);
});

was working in 24.7.1 and stopped working in 24.9.0.

The bug seems to be in the implementation of #8687.
I think the entry in seenReferences has to be evicted when the function that sets it return.

@celerytea
Copy link
Author

Fixed by #9322

@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 May 11, 2021
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

2 participants