-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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: add checkPrototype option for assert.deepStrictEqual() #29334
Conversation
Allow usage of assert.deepStrictEqual() without prototype checks. Refs: nodejs#28011
Seemed like a pretty good idea when we talked about it in #28011 but now that it's implemented, I wonder if we're trying to solve the wrong problem. People already have a way to do this: assert.deepEqual(). This doesn't really provide a smooth onramp to moving to assert.deepStrictEqual() since it won't work in older versions of Node.js. If people want strict comparisons, they can use Object.create() or Object.setPrototypeOf() or another mechanism to duplicate prototypes to their test results. |
Maybe a smooth-enough onramp might be to set Interested in @BridgeAR's thoughts on the above. |
Although I guess that could be a foot-gun for current |
@nodejs/assert |
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 would rather not add this option. Instead, I would favor rewriting assert to a class where it's possible to set options. One of those could be to deactivate the prototype check.
We just have to make sure to keep the assert module backwards compatible.
Allow usage of assert.deepStrictEqual() without prototype checks.
Refs: #28011
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes