-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
doc: mention constructor comparison in assert.deepStrictEqual #60253
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
base: main
Are you sure you want to change the base?
doc: mention constructor comparison in assert.deepStrictEqual #60253
Conversation
Updated `assert.deepStrictEqual` docs to explicitly mention that object constructors are included in the comparison. This clarifies behavior consistent with `util.isDeepStrictEqual` and helps prevent confusion when comparing derived objects or proxy instances.
doc/api/assert.md
Outdated
* [Type tags][Object.prototype.toString()] of objects should be the same. | ||
* Only [enumerable "own" properties][] are considered. | ||
* Object constructors are also compared to ensure that instances are strictly deep-equal. | ||
This means that even if two objects share the same prototype and properties, differing constructors will result in inequality. |
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 do not think we should explain how things work and instead just explain what happens.
This means that even if two objects share the same prototype and properties, differing constructors will result in inequality. |
doc/api/assert.md
Outdated
both sides are {NaN}. | ||
* [Type tags][Object.prototype.toString()] of objects should be the same. | ||
* Only [enumerable "own" properties][] are considered. | ||
* Object constructors are also compared to ensure that instances are strictly deep-equal. |
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.
This is actually not always true, e.g., for null prototypes, there is no constructor.
I am not sure how to word it appropriately right now.
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.
Thanks for the feedback @BridgeAR!
I’ve simplified the sentence to describe the behavior only, as suggested.
I do apologize
There are no bad intentions I just trying to do it and did not know how to
fix it 😔
Is there a way you out can help me please
Blanca c
El mar, 21 de oct de 2025, 10:43 a.m., Hamza ***@***.***>
escribió:
… ***@***.**** commented on this pull request.
------------------------------
In doc/api/assert.md
<#60253 (comment)>:
> @@ -399,6 +399,8 @@ are also recursively evaluated by the following rules.
both sides are {NaN}.
* [Type tags][Object.prototype.toString()] of objects should be the same.
* Only [enumerable "own" properties][] are considered.
+* Object constructors are also compared to ensure that instances are strictly deep-equal.
Thanks for the feedback @BridgeAR <https://github.com/BridgeAR>!
I’ve simplified the sentence to describe the behavior only, as suggested.
—
Reply to this email directly, view it on GitHub
<#60253 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AIXDFWUV45WYZ7EQEOZIURL3YZWCNAVCNFSM6AAAAACJEQNED6VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTGNRRHE3DKOBQG4>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Updated
assert.deepStrictEqual
docs to explicitly mention that object constructors are included in the comparison. This clarifies behavior consistent withutil.isDeepStrictEqual
and helps prevent confusion when comparing derived objects or proxy instances.