You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
expect(undefined).toEqual(expect.objectContaining({}));expect('test').toEqual(expect.objectContaining({}));expect(1).toEqual(expect.objectContaining({}));// Expecting the array to contain an object.expect([]).toEqual([expect.objectContaining({})]);
expect.objectContaining(object) matches any received object that recursively matches the expected properties. That is, the expected object is a subset of the received object.
However objectContaining can match any type, not just objects. This leads to all sorts of tests unexpectedly passing.
Version
29.7.0
Steps to reproduce
Expected behavior
All tests above should fail.
Actual behavior
All tests pass.
Additional context
The documentation states that:
However
objectContaining
can match any type, not just objects. This leads to all sorts of tests unexpectedly passing.Environment
The text was updated successfully, but these errors were encountered: