Open tomhicks opened 1 year ago
1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983
Darwin 22.2.0 arm64 arm
function proxify<T extends object>(thing: T): T { return new Proxy(thing, { get: function (target, prop) { return (target as any)[prop]; }, set: function (target, prop, value) { (target as any)[prop] = value; return true; }, }); } test("nested proxy equality", () => { const thing = { a: [1] }; const pr = proxify(thing); thing.a = proxify(thing.a); expect(equal(thing, pr)).toBe(true); // this is fine expect(pr).toEqual({ a: [1] }); // this fails });
The test should pass. Deeply-nested proxies should be considered equal according to toEqual. This works in Jest.
toEqual
The test fails, printing out nearly identical objects.
error: expect(received).toEqual(expected) + {"a":[1]} - { - a: [ - 1 - ] - } - Expected - 5 + Received + 1
No response
Tagging @dai-shi as this prevents Valtio from working as it should, as it deeply nests proxies.
What version of Bun is running?
1.0.0+822a00c4d508b54f650933a73ca5f4a3af9a7983
What platform is your computer?
Darwin 22.2.0 arm64 arm
What steps can reproduce the bug?
What is the expected behavior?
The test should pass. Deeply-nested proxies should be considered equal according to
toEqual
. This works in Jest.What do you see instead?
The test fails, printing out nearly identical objects.
Additional information
No response