We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
This was originally opened by @glenjamin in #15342, but it was closed due to inactivity.
30.0.0-alpha.7
describe('something', () => { it('should work', () => { const f = jest.fn(); f({ a: 1, b: 2 }); f({ a: 3, b: 7 }); expect(f).toHaveBeenCalledWith(expect.objectContaining({ b: 7 })); }); });
Test passes
FAIL ./demo.test.js something ✕ should work (38 ms) ● something › should work expect(jest.fn()).toHaveBeenCalledWith(...expected) Expected: ObjectContaining {"a": 1, "b": 7} Received 1: {"a": 1, "b": 2} 2: {"a": 3, "b": 7} Number of calls: 2 5 | f({ a: 3, b: 7 }); 6 | > 7 | expect(f).toHaveBeenCalledWith(expect.objectContaining({ b: 7 })); | ^ 8 | }); 9 | }); 10 | at Object.toHaveBeenCalledWith (demo.test.js:7:15)
@glenjamin's comment on the original issue #15342:
I've traced this back to 169ba83#diff-f8846ea7aae48b4baadb9c50ba129cdadc6783e6051e605b5e2827153fc04479R253 The assumption that this.sample is safe to modify is incorrect. I expect that this will fail in any scenario where objectContaining is compared against multiple values cc @colinacassidy who supplied the previous fix
I've traced this back to 169ba83#diff-f8846ea7aae48b4baadb9c50ba129cdadc6783e6051e605b5e2827153fc04479R253
The assumption that this.sample is safe to modify is incorrect.
I expect that this will fail in any scenario where objectContaining is compared against multiple values
cc @colinacassidy who supplied the previous fix
System: OS: macOS 15.2 CPU: (10) arm64 Apple M1 Max Binaries: Node: 18.20.1 Yarn: 4.4.0 npm: 9.9.3 pnpm: 9.1.0 npmPackages: jest: ^30.0.0-alpha.5 => 30.0.0-alpha.7
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
This was originally opened by @glenjamin in #15342, but it was closed due to inactivity.
Version
30.0.0-alpha.7
Steps to reproduce
Expected behavior
Test passes
Actual behavior
Additional context
@glenjamin's comment on the original issue #15342:
Environment
System: OS: macOS 15.2 CPU: (10) arm64 Apple M1 Max Binaries: Node: 18.20.1 Yarn: 4.4.0 npm: 9.9.3 pnpm: 9.1.0 npmPackages: jest: ^30.0.0-alpha.5 => 30.0.0-alpha.7
The text was updated successfully, but these errors were encountered: