-
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: Assert will only check enumerable properties #52534
Comments
It is actually documented as IMO, if it changes to match also the non-enumerable one, there should remain one function for the enumerable property only. |
I also think this is more a feature request than a bug. WDYT @nodejs/assert ? |
Thanks for the information, @climba03003 and @MoLow. In any case, this feature of checking non-enumerable properties should (IMO) exist in NodeJS, even if in a separate function/flag. If you'd like, I can work on this (unless someone else wants to take on the task?) |
This was discussed a few times in the past (earliest I found without going to the v0.x repo, there are earlier requests I remember #3122 (comment) ). It was "by design" to match user expectations, we can revisit this but I'm not sure we should. (There are plenty of other things to fix in assert with easier consensus btw) |
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-stale
|
@RedYetiDev did you have the demand for that in a real application? I believe it is probably easy to work around this. I suggest we close this one as won't fix, depending on that input. |
No. Feel free to close this. |
Version
v21.7.3
Platform
Linux <>-KALI 6.6.9-amd64 #1 SMP PREEMPT_DYNAMIC Kali 6.6.9-1kali1 (2024-01-08) x86_64 GNU/Linux
Subsystem
assert
What steps will reproduce the bug?
Setup an file like:
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
What do you see instead?
undefined
Additional information
This issue is caused because
ObjectKeys
(Object.keys
) does not count non-enumerable objects:node/lib/internal/util/comparisons.js
Line 274 in f425710
View Full Function
node/lib/internal/util/comparisons.js
Lines 263 to 379 in f425710
I believe that this could be resolved via the use of
getOwnPropertyNames
instead, but I wanted to put this as an issue before making any changes.The text was updated successfully, but these errors were encountered: