jest icon indicating copy to clipboard operation
jest copied to clipboard

[Bug]: expect().toEqual does not compare unique node properties

Open mozesstumpf opened this issue 2 years ago • 1 comments

Version

29.5.0

Steps to reproduce

it("tests the node's properties", () => {
	const text1 = document.createTextNode("text");
	text1.customProperty = "customProperty";

	const text2 = document.createTextNode("text");

	expect(text1).toEqual(text2); // Passed
});

Expected behavior

Test should fail since the text1 has a custom property.

Actual behavior

The expect().toEqual method can't detect the custom properties on the Node, same goes for the toStrictEqual.

Additional context

No response

Environment

System:
    OS: Windows 11 10.0.22621
    CPU: (12) x64 AMD Ryzen 5 5600 6-Core Processor
  Binaries:
    Node: 18.18.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 9.8.1 - C:\Program Files\nodejs\npm.CMD
  npmPackages:
    jest: ^29.5.0 => 29.7.0

mozesstumpf avatar Jan 09 '24 13:01 mozesstumpf

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 30 days.

github-actions[bot] avatar Feb 08 '24 19:02 github-actions[bot]

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.

github-actions[bot] avatar Mar 09 '24 20:03 github-actions[bot]

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.

github-actions[bot] avatar Mar 09 '24 20:03 github-actions[bot]

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. Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

github-actions[bot] avatar Apr 09 '24 00:04 github-actions[bot]