-
-
Notifications
You must be signed in to change notification settings - Fork 115
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
toMatchElement() does not behave like matchesElement() #163
Comments
That's a really good question... We use .debug() on the nodes to compare the output strings for some reason. I can't remember why we do that. It seems like the wrong idea.. I wonder if @finnigantime remembers why that approach was desired. |
Any news on this? |
I too would like to know - having to match all props is not always ideal |
Hey, sorry for late reply. See more context in #95. I think ignoring props is just a missing option (and should probably be the default option). I added the option to ignore props to enzyme's debug() in enzymejs/enzyme#961 but I guess I never came back and plumbed through the I also agree with @blainekasten that comparing strings is not ideal - comparing structured data objects may be better than comparing strings from a maintainability point of view. One advantage of comparing strings is the diff is obvious and very human readable which is helpful when the expect fails. |
I cannot get to this right now, but am happy to code review if someone wants to put up a fix - should be fairly straightforward. Otherwise I can take a stab at it when I get some more time. |
I have a component that does something like this:
This test with enzyme-matchers fails:
I see:
With a vanilla Jest/enzyme assertion the test passes:
Shouldn't these both behave the same?
I'm running tests in Node with mocha. Versions:
The text was updated successfully, but these errors were encountered: