-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
objectContaining not matching valid subset per docs #11126
Comments
This is a duplicate of #10462. Despite what the documentation says, describe("objectContaining", () => {
it("should work", () => {
const headers = new Headers({});
headers.set("weee", "weee");
expect({
a: "a",
headers,
b: {
c: new Map(),
d: "awfiotnaf",
},
}).toEqual(
expect.objectContaining({
b: expect.objectContaining({
d: expect.any(String),
}),
})
);
});
}); A previous attempt to fix this was made in #10508. Unfortunately, #10508 broke a lot of things (see #10689, #10716), and had to be reverted, in #10766. The disposition as of #10716 (comment) was that the implementation is correct and the documentation is wrong, but the docs haven't been fixed yet. |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
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. |
🐛 Bug Report
Per the docs https://jestjs.io/docs/en/expect#expectobjectcontainingobject, the following minimal assertion is expected to pass
.toEqual
seems suspicious, but peers in the community have asserted that because of the subset language, the above should still. take.To Reproduce
pnpx jest
Link to repl or repo (highly encouraged)
https://github.com/cdaringe/jest-object-containing
envinfo
The text was updated successfully, but these errors were encountered: