-
Notifications
You must be signed in to change notification settings - Fork 30k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assert: fix deepEqual RangeError: Maximum call stack size exceeded #13318
Conversation
CI: https://ci.nodejs.org/job/node-test-pull-request/8377/ I'm a bit confused as to how this fixes it, though. |
The CI seems to not like this change. |
/cc @addaleax, @joyeecheung |
Ouch. Somehow I mistakenly thought that Btw, it seems like the only failing case is the following:
And it's strange... will investigate. |
lib/assert.js
Outdated
if (actualPosition === memos.expected.map.get(expected)) { | ||
return true; | ||
} | ||
return actualPosition === memos.expected.map.get(expected); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the failed test case is caused by memos.expected.map.get(expected)
returning undefined
? To make sure the two are visited in the same order, we need to first make sure expected
has actually been visited before, so this should not return false when expected
has not been visited (memos.expected.map.get(expected) === undefined
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the point. I tried it and indeed, it makes the case pass. However, at first, it breaks (or changes expectations of the) test added by the PR from "throws" to "not throws", which is probably not a bad thing, but rather a point that requires some discussion. Secondly, I was able to create a case that still fails:
var a = [ 1, 2 ]
var b = [ 3, 4 ]
var c = [ 1, 2 ]
var d = [ 3, 4 ]
assertDeepAndStrictEqual({
v: a,
s: new Set([a, b])
}, {
v: c,
s: new Set([d, c])
});
This commit changes semantics of the memos cycles tracker. Before the change it was used to track all currently wisited nodes of an object tree, which is a bit shifted from its original intention of tracking cycles. The change brings intended semantics, by tracking only objects of the current branch of the object tree. Fixes: nodejs#13314
I have changed |
CI failure is unrelated |
Fixes: #13314 Refs: #6416 This commit changes semantics of the memos cycles tracker. Before the change it was used to track all currently wisited nodes of an object tree, which is a bit shifted from its original intention of tracking cycles. The change brings intended semantics, by tracking only objects of the current branch of the object tree. PR-URL: #13318 Fixes: #13314 Ref: #6416 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Landed in b1ed55f |
Fixes: #13314 Refs: #6416 This commit changes semantics of the memos cycles tracker. Before the change it was used to track all currently wisited nodes of an object tree, which is a bit shifted from its original intention of tracking cycles. The change brings intended semantics, by tracking only objects of the current branch of the object tree. PR-URL: #13318 Fixes: #13314 Ref: #6416 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
This does not land cleanly in LTS. Please feel free to manually backport. Please also feel free to replace the backport request label with do-not-land if it shouldn't land |
@MylesBorins Note that people who are not in the Collaborators team cannot add or remove labels. So if a PR is authored by a non-Collaborator, perhaps ask the contributor to comment instead of replacing a label. |
Agreed. @MylesBorins it's probably also worth adding the link to the backporting guide This is my saved reply:
Maybe we should have a stock one. |
Fixes: #13314
Refs: #6416
Checklist
make -j4 test
passesAffected core subsystem(s)
assert