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

Wrong highlight in diffs when using asymmetric matcher in symbol-keyed object property. #9432

Closed
WeiAnAn opened this issue Jan 20, 2020 · 2 comments · Fixed by #9499
Closed
Labels

Comments

@WeiAnAn
Copy link
Contributor

WeiAnAn commented Jan 20, 2020

🐛 Bug Report

Because Object.entries only work on string-keyed property.
https://github.com/facebook/jest/blob/823677901b9632dbfb9397bf5eef2d32b78527a4/packages/jest-matcher-utils/src/Replaceable.ts#L33-L37

For more informations

To Reproduce

expect({
  a: 1,
  [Symbol.for('jest')]: 2,
}).toEqual({
  a: 2,
  [Symbol.for('test')]: expect.any(Number),
});

Output:

Object {
-   "a": 2,
-   Symbol(test): Any<Number>,
+   "a": 1,
+   Symbol(jest): 2,
}

Expected behavior

Object {
-   "a": 2,
+   "a": 1,
    Symbol(test): Any<Number>,
}

Link to repl or repo (highly encouraged)

envinfo

Binaries:
    Node: 10.17.0 - ~/.nvm/versions/node/v10.17.0/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.11.3 - ~/.nvm/versions/node/v10.17.0/bin/npm
@SimenB
Copy link
Member

SimenB commented Jan 20, 2020

Thank you 🙂

@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.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants