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

Open
lcswillems opened this issue Feb 14, 2024 · 5 comments · May be fixed by #15038
Open

[Bug]: Wrong diff for objectContaining #14897

lcswillems opened this issue Feb 14, 2024 · 5 comments · May be 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.

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

Successfully merging a pull request may close this issue.

2 participants