"Received: serializes to the same string" on object equality checking
## 🐛 Bug Report Using `.toMatchObject()` returns failing test with message ` Received: serializes to the same string`  ## To Reproduce I am trying to check the `users` object I receive against my `expectedUsers`. The received object coming back from MongoDB contains the fields `"__v"` and `"_id"` which I do not want to check for (they always change for every test). As such, I am using `.toMatchObject()` and cannot use something else like `.toEqual()`. My test snippet is below: ``` test("should show all existing users", async () => { const expectedUsers = [ { email: "andy@example.com", friends: [], followers: [], following: [], blocked: [] }, { email: "john@example.com", friends: ["andy@example.com", "mary@example.com"], followers: [], following: [], blocked: [] }, { email: "mary@example.com", friends: [], followers: [], following: [], blocked: ["john@example.com"] } ]; await request(app) .get(route(path)) .expect("Content-Type", /json/) .expect(200); const users = await User.find(); expect(users).toMatchObject(expectedUsers); }); ``` (`request` is made with `supertest`) ## Expected behavior As documented [here](https://jestjs.io/docs/en/expect.html#tomatchobjectobject), > Use .toMatchObject to check that a JavaScript obje
Posted by sabriele on May 20, 2019, 10:44 AM
Tags
Related issues
- 2026 - Microsoft Office 365
- [Ubuntu] `ubuntu-latest` label will use Ubuntu 26.04 in November 2026
- Gamut mapping
- [Codex Desktop] Editing and resending a queued message triggers "App-server queued follow-up no longer exists"
- [Windows] ChatGPT 26.820.60940 fails with "invalid transport in mcp_servers.codex_app"; Beta 26.727.40816 works
- [BUG]: infinite loading of videos
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
github (SaaS)
2026 - Microsoft Office 365
[Ubuntu] `ubuntu-latest` label will use Ubuntu 26.04 in November 2026
Gamut mapping
[Codex Desktop] Editing and resending a queued message triggers "App-server queued follow-up no longer exists"
[Windows] ChatGPT 26.820.60940 fails with "invalid transport in mcp_servers.codex_app"; Beta 26.727.40816 works
[BUG]: infinite loading of videos
Restore GPT-5.6 Sol’s 372k Codex context window, or provide an opt-in setting
Codex Desktop for macOS repeatedly triggers `syspolicyd` / `trustd` CPU and memory runaway
"Received: serializes to the same string" on object equality checking
## 🐛 Bug Report Using `.toMatchObject()` returns failing test with message ` Received: serializes to the same string`  ## To Reproduce I am trying to check the `users` object I receive against my `expectedUsers`. The received object coming back from MongoDB contains the fields `"__v"` and `"_id"` which I do not want to check for (they always change for every test). As such, I am using `.toMatchObject()` and cannot use something else like `.toEqual()`. My test snippet is below: ``` test("should show all existing users", async () => { const expectedUsers = [ { email: "andy@example.com", friends: [], followers: [], following: [], blocked: [] }, { email: "john@example.com", friends: ["andy@example.com", "mary@example.com"], followers: [], following: [], blocked: [] }, { email: "mary@example.com", friends: [], followers: [], following: [], blocked: ["john@example.com"] } ]; await request(app) .get(route(path)) .expect("Content-Type", /json/) .expect(200); const users = await User.find(); expect(users).toMatchObject(expectedUsers); }); ``` (`request` is made with `supertest`) ## Expected behavior As documented [here](https://jestjs.io/docs/en/expect.html#tomatchobjectobject), > Use .toMatchObject to check that a JavaScript obje
Comments (0)
No comments yet. Start the discussion.