-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Upgrading from [email protected] -> 1.15.2 breaks connected component tests #2390
Comments
@ljharb i dug into this a bit more and narrowed it down to #2300, specifically this commit, which fixes #2297 I don't totally understand why react change the way they do things, but the change to enzyme's own I'll try to get a codesandbox repro up and dig into what is going wrong more. |
@bdwain thanks, appreciate that |
@ljharb here's a code sandbox (open the console) https://codesandbox.io/s/quirky-sun-rpwd3. Notice that the displayname of the rendered element from the shallow wrapper does not match the display name of the actual element. because it took the inner "type" when calculating it in enzyme. I'll keep looking at this, but please let me know if something stands out. |
notice in the sandbox that isMemo is false on wrapper.get(0) but true on the plain element. it seems like isMemo returns true on an element normally, but not if it's rendered in the shallow renderer (or maybe mount too). If we can adress that issue, i bet we could go back to using the published isMemo functions. |
i think i found the issue actually @ljharb
There we get the output from the renderer (which i ran through react's isMemo and it returned true) and we just throw it away and lose the type info that react gave it that their new isMemo and isLazy checks are based on. Is the point of that to give a consistent interface between different react versions? It seems we need some way of maintaining the object's type while creating an object with a consistent interface. does that sound like i'm on the right track? |
Hey @ljharb were you ever able to look at this? It'd be great to get this fixed. I'm happy to help I just want to make sure I'm on the right path before I go too far, and to see if anything jumps out at you given what I found so far. |
Sorry, i haven’t had time to look at it yet. If you can provide a test case in a PR, with or without a fix, i can get it reviewed and merged and released ASAP :-) |
@bdwain your failing test is helpful, but |
@ljharb not really sure what you mean. It's returning false for me too, but that's why the test is failing. It should be returning true. Is there something else you need from me to get this fixed? |
@bdwain you said:
but react’s isMemo returned false for that for me. |
So the bug, in other words, seems like it’s in react-is, if that is supposed to return true? |
you ran isMemo on the output from the shallow renderer? It was a year ago but I can try to redo my test. I feel like at the time though, I understood the issue to be that the renderer output has some type information on it, but a node is being manually created at
and that throws away the type info that react-is relies on. |
hmm, ok - if that's the case then that seems like an easy fix to make. want to make a PR? :-) |
well i wasn't sure what the fix was exactly.
it seemed like we threw away the type info on purpose, to make a consistent interface? |
Current behavior
When I upgrade from 1.15.1 of enzyme-adapter-react-16 to version 1.15.2, I am running into JSX comparison test failures with connected components.
Ex.
Note:
toEqualJSX
-> https://www.npmjs.com/package/jasmine-expect-jsx is a simple wrapper aroundreact-element-to-jsx-string
-> https://github.com/algolia/react-element-to-jsx-string and turns a react element into a JSX string.Expected behavior
Expect tests to still pass without change after bumping minor version
Your environment
API
Version
Adapter
The text was updated successfully, but these errors were encountered: