assert: add checkPrototype option for assert.deepStrictEqual()#29334
assert: add checkPrototype option for assert.deepStrictEqual()#29334Trott wants to merge 1 commit intonodejs:masterfrom
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.
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