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]: Wrong diff for objectContaining #14897

Closed
lcswillems opened this issue Feb 14, 2024 · 7 comments · Fixed by #15038
Closed

[Bug]: Wrong diff for objectContaining #14897

lcswillems opened this issue Feb 14, 2024 · 7 comments · Fixed by #15038

Comments

@lcswillems
Copy link

Version

29.7

Steps to reproduce

https://stackblitz.com/edit/vitejs-vite-rnytfb

Run npm run test-jest

Expected behavior

Message:
expect(received).toEqual(expected) // deep equality

- Expected  - 2
+ Received  + 2

- ObjectContaining {
+ Object {
    "a": 1,
    "b": 2,
-   "c": 2,
+   "c": 3,
  }

Actual behavior

Message:
expect(received).toEqual(expected) // deep equality

- Expected  - 2
+ Received  + 3

- ObjectContaining {
+ Object {
+   "a": 1,
    "b": 2,
-   "c": 2,
+   "c": 3,
  }

Additional context

No response

Environment

System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.14.0 - /usr/local/bin/pnpm
  npmPackages:
    jest: ^29.7.0 => 29.7.0
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.

@github-actions github-actions bot added the Stale label Mar 15, 2024
@lcswillems
Copy link
Author

lcswillems commented Mar 15, 2024

Not stale ofc. It is not because there is no activity that the bug disappears.

@github-actions github-actions bot removed the Stale label Mar 15, 2024
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.

@github-actions github-actions bot added the Stale label Apr 14, 2024
@lcswillems
Copy link
Author

No

@github-actions github-actions bot removed the Stale label Apr 14, 2024
@spacechimplives
Copy link

Im' getting this error:

TypeError: (0 , _expectUtils.getObjectKeys) is not a function

for this test:

describe('Minimal test case', () => {
test('Expect object containing', () => {
expect({ hours: 12, minutes: 54 }).toEqual(expect.objectContaining({ hours: 12, minutes: 54}));
});
});

It appears there's somethign broken with objectContaining.

@SimenB
Copy link
Member

SimenB commented May 12, 2024

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 Jun 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants