-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Closed
Labels
Description
Version
28.1.3
Steps to reproduce
- Install latest Immutable.js(v4.1.0) and jest.
- e.g.
yarn install immutable jest
- e.g.
- Create the following test file and run the test.
const Immutable = require("immutable");
it("passed in jest 27.5.1, but failure in jest 28.1.3", () => {
class MyRecord extends Immutable.Record({ dummy: "" }) {}
const a = new MyRecord().merge({ dummy: "data" });
const b = new MyRecord().set("dummy", "data");
expect(Immutable.is(a, b)).toBe(true);
expect(a).toEqual(b);
});
Expected behavior
I expect to pass the test.
Actual behavior
The isEqual
test fails.
● passed in jest 27.5.1, but failure in jest 28.1.3
expect(received).toEqual(expected) // deep equality
Expected: Immutable.Record {"dummy": "data"}
Received: serializes to the same string
9 | console.log(b._values._tail.ownerID);
10 | expect(Immutable.is(a, b)).toBe(true);
> 11 | expect(a).toEqual(b);
| ^
12 | });
13 |
Additional context
This issue is similar to #12752, #12860, and #12976.
The reason to fail may be same these issues.
Immutable.Record has values
of Immutable.List. The test fails because change values._tail.ownerID
by the operation.
console.log
a._values._tail.ownerID: OwnerID {}
at Object.log (__tests__/index.test.js:8:11)
console.log
b._values._tail.ownerID: undefined
at Object.log (__tests__/index.test.js:9:11)
Environment
System:
OS: macOS 12.4
CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
Binaries:
Node: 16.13.0 - ~/.nodenv/versions/16.13.0/bin/node
Yarn: 1.22.17 - ~/.nodenv/versions/16.13.0/bin/yarn
npm: 8.1.4 - ~/.nodenv/versions/16.13.0/bin/npm
npmPackages:
jest: ^28.1.3 => 28.1.3