You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, it looks like Node 12 changed how arrays are compared with deepEqual(), presumably due to https://github.com/nodejs/node/pull/25008/files . Here's an example of how deepEqual() handles arrays with symbol properties:
$ ~/Workspace/libs/node-v12.0.0-linux-x64/bin/node test.js
v12.0.0
assert.js:89
throw new AssertionError(obj);
^
AssertionError [ERR_ASSERTION]: Expected values to be loosely deep-equal:
[
[Symbol(foo)]: 42
]
should equal
[]
$
Is this a bug or expected behavior? If so, you should update the legacy mode deepEqual() docs, which explicitly state that symbol properties are ignored.
This was indeed an unintentional change and I missed that the array optimization currently always gets the symbol properties even though the loose equal comparison should not compare symbol properties. I'll open a PR to fix that.
This is the way it's currently documented and that seems appropriate
for loose equal assertions. The change was not intentional.
Fixes: #27652
PR-URL: #27653
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Hi, it looks like Node 12 changed how arrays are compared with
deepEqual()
, presumably due to https://github.com/nodejs/node/pull/25008/files . Here's an example of howdeepEqual()
handles arrays with symbol properties:Running this script with Node.js 11.9.0 succeeds:
Running with Node.js 12 fails:
Is this a bug or expected behavior? If so, you should update the legacy mode
deepEqual()
docs, which explicitly state that symbol properties are ignored.Related to Automattic/mongoose#7784.
The text was updated successfully, but these errors were encountered: