-
Notifications
You must be signed in to change notification settings - Fork 30.7k
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
Expose the existing mechanisms behind assert.deepEqual
#33738
Comments
The I am fine to expand the functionality in a similar fashion as laid out here. I would like to have options to define specific behaviour such as Adding the contains functionality is a tiny bit more work and we should make sure the performance won't degrade in case we combine the logic. |
Can you explain why (other than API ugliness) you can't accomplish this by wrapping the assert with a try/catch and seeing if an exception was thrown?
That sounds reasonable to me, but I'd like to understand how that behaves - and if we add an |
Sure. Try-Catch is a heavy mechanism. The construction of an error is heavy and throwing and catching it is heavy. Transpiled async wraps it in
Hmm. That makes sense to me.
😉 @BridgeAR How would you propose to test performance? |
There are enough benchmarks in |
@BridgeAR - that's great. I found the benches. MM. I also understand I have to install |
@osher the parameters are documented in R is used to transform the raw data in nice to read output such as x percent increase / decrease between different benchmarks. |
@osher take a look at this guide for detailed explanation https://github.com/nodejs/node/blob/master/doc/guides/writing-and-running-benchmarks.md. |
awsome. cool stuff. |
There has been no activity on this feature request for 5 months and it is unlikely to be implemented. It will be closed 6 months after the last non-automated comment. For more information on how the project manages feature requests, please consult the feature request management document. |
Yeah this has stalled and can still be explored sometime in the future if people put the time/effort :) |
Is your feature request related to a problem? Please describe.
I've been working on a testing tools set as part of some new proprietary ecosystem
(with the intent to open-source elements from it once they are stable enough in their form and require less maintenance, but so far it's proprietary :( ).
As part of this testing framework, I need to perform a deep comparison of objects.
As a start - I got
assert.deepEqual
- which is great. However - it ends with an exception.Sometimes I would like to manage the exception myself - I just need the indication.
I decided to open this issue when I came across more use-cases:
For this - we need a form of
containsEql
.In all of the cases, it's beneficial to be able to perform both
containsEql
anddeepEqual
.I did see
util.isDeepStrictEqual
- and despite the confusing name that gave me hope.(I mean, it took me a lot of tries to understand that
strict
does not mean reference-comparison, but comparison without conversion of values. The first time I saw it I struggled to understand what it means - does it compare shallow copies? I had to try and see for myself. Anyway - I'm side tracking)Describe the solution you'd like
I would propose on the same spirit of
util.isDeepStrictEqual(..)
util.isDeepStrictContain(..)
I also saw the underlying mechanisms with the
bStirct
flag, and thought it could also be useful to let users inject it if they so choose, but I'm not sure about the names or the form it should take.I'll be happy to start work on it if we can agree on the form it should take.
I mean, the mechanisms are there, and their functionality is all well-tested.
We just need to feature them and add only tests that show they are available, or even reuse parts of the existing tests - but expect a boolean instead of an error.
Describe alternatives you've considered
All current alternatives come from userland codes, which basically duplicate the same logic and introduce their own takes and flavors. Which is a pity...
We have that logic in
node
, and it's a good logic that runs deep and already serves now a role in APIs used by userland.The text was updated successfully, but these errors were encountered: