-
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: allow circular references #6432
Conversation
return objEquiv(actual, expected, strict); | ||
memos = memos || {actual: [], expected: []}; | ||
|
||
if (memos.actual.includes(actual)) { |
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.
Maybe use memos.actual.indexOf
here and cache it for the next call?
Looks like @nodejs-github-bot wrongly labeled this, investigating at #6432 |
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a RangeError if passed objects with circular references. Fixes: nodejs#6416
This fixes some bad labelling by ensuring that *every* file affected in the PR actually matches an exclusive label when we're checking for exclusive labels. Refs nodejs/node#6448 nodejs/node#6432 Closes #33
Took @addaleax's suggestions, rebased, force-pushed. Hoping to hold off on CI until the pesky issues with tick processor vs. OS X are resolved. |
This fixes some bad labelling by ensuring that *every* file affected in the PR actually matches an exclusive label when we're checking for exclusive labels. Refs nodejs/node#6448 nodejs/node#6432 Closes #33
LGTM |
1 similar comment
LGTM |
Isn't assert just for the core? Does the core need this change? |
@thefourtheye asked:
It's not difficult to imagine that a test we write might want to compare two objects that contain circular references. I think it makes sense to fix this bug before we come across that need rather than waiting for it to come up and create problems for the person who is writing that test. This is a bug fix. If it were a new feature or an API change, the bar would be considerably higher (in my opinion, at least). |
+1 to what @Trott said. |
Well, most of the times we would be able to argue that features are bug fixes and vice versa. For example, this patch could also be interpreted as, asserting circular references feature. At the same time, #2315 can be argued as, bug while asserting |
@thefourtheye I'm taking your comments to mean that you might be skeptical of the need for this, but you aren't opposed to doing this. So I'm going to land this now. (But if I'm wrong, we can revert.) |
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a RangeError if passed objects with circular references. PR-URL: nodejs#6432 Fixes: nodejs#6416 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Landed in d3aafd0. |
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a RangeError if passed objects with circular references. PR-URL: nodejs#6432 Fixes: nodejs#6416 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
* assert: `deep{Strict}Equal()` now works correctly with circular references. (Rich Trott) #6432 * debugger: Arrays are now formatted correctly in the debugger repl. (cjihrig) #6448 * deps: Upgrade OpenSSL sources to 1.0.2h (Shigeki Ohtsu) #6550 * net: Introduced a `Socket#connecting` property. (Fedor Indutny) #6404 - Previously this information was only available as the undocumented, internal `_connecting` property. * process: Introduced `process.cpuUsage()`. (Patrick Mueller) #6157 * stream: `Writable#setDefaultEncoding()` now returns `this`. (Alexander Makarenko) #5040 * util: Two new additions to `util.inspect()`: - Added a `maxArrayLength` option to truncate the formatting of Arrays. (James M Snell) #6334 - This is set to `100` by default. - Added a `showProxy` option for formatting proxy intercepting handlers. (James M Snell) #6465 - Inspecting proxies is non-trivial and as such this is off by default. PR-URL: #6557
* assert: `deep{Strict}Equal()` now works correctly with circular references. (Rich Trott) #6432 * debugger: Arrays are now formatted correctly in the debugger repl. (cjihrig) #6448 * deps: Upgrade OpenSSL sources to 1.0.2h (Shigeki Ohtsu) #6550 - Please see our blog post for more info on the security contents of this release: - https://nodejs.org/en/blog/vulnerability/openssl-may-2016/ * net: Introduced a `Socket#connecting` property. (Fedor Indutny) #6404 - Previously this information was only available as the undocumented, internal `_connecting` property. * process: Introduced `process.cpuUsage()`. (Patrick Mueller) #6157 * stream: `Writable#setDefaultEncoding()` now returns `this`. (Alexander Makarenko) #5040 * util: Two new additions to `util.inspect()`: - Added a `maxArrayLength` option to truncate the formatting of Arrays. (James M Snell) #6334 - This is set to `100` by default. - Added a `showProxy` option for formatting proxy intercepting handlers. (James M Snell) #6465 - Inspecting proxies is non-trivial and as such this is off by default. PR-URL: #6557
* assert: `deep{Strict}Equal()` now works correctly with circular references. (Rich Trott) #6432 * debugger: Arrays are now formatted correctly in the debugger repl. (cjihrig) #6448 * deps: Upgrade OpenSSL sources to 1.0.2h (Shigeki Ohtsu) #6550 - Please see our blog post for more info on the security contents of this release: - https://nodejs.org/en/blog/vulnerability/openssl-may-2016/ * net: Introduced a `Socket#connecting` property. (Fedor Indutny) #6404 - Previously this information was only available as the undocumented, internal `_connecting` property. * process: Introduced `process.cpuUsage()`. (Patrick Mueller) #6157 * stream: `Writable#setDefaultEncoding()` now returns `this`. (Alexander Makarenko) #5040 * util: Two new additions to `util.inspect()`: - Added a `maxArrayLength` option to truncate the formatting of Arrays. (James M Snell) #6334 - This is set to `100` by default. - Added a `showProxy` option for formatting proxy intercepting handlers. (James M Snell) #6465 - Inspecting proxies is non-trivial and as such this is off by default. PR-URL: #6557
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a RangeError if passed objects with circular references. fix: twada#3 refs:nodejs/node#6416 nodejs/node#6432
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a RangeError if passed objects with circular references. fix: twada#3 refs:nodejs/node#6416 nodejs/node#6432
@Trott lts? |
@thealphanerd Yes, if it lands cleanly. |
Checklist
Affected core subsystem(s)
assert test
Description of change
assert.deepEqual() and assert.deepStrictEqual() will no longer throw a
RangeError if passed objects with circular references.
Fixes: #6416