-
-
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
Show functions and not <Profiler/> with react 16.3 #1793
Conversation
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.
Thanks - could you add a test case that would fail without your changes?
case AsyncMode: return 'AsyncMode'; | ||
case Fragment: return 'Fragment'; | ||
case StrictMode: return 'StrictMode'; | ||
case Profiler: return 'Profiler'; |
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 wonder if a simpler change, since this is the 16.3 adapter, would be to just delete the Profiler line?
We'll also need the same change in the 16 adapter, since that still supports 16.0 - 16.4. |
hmm, we have an explicit test that covers function children showing up as |
I'm a bit confused now.
I don't have a (unit) test case at the moment but I can have a go at writing one once I understand what changes you want. |
@lukeapage the 16.3 adapter does not support 16.4, only the 16 adapter does. I've already pushed up commits that use Specifically I'm interested in reproducing:
from your OP. Can you provide a case that does that in React 16.3? |
I followed the instructions and I get errors running anything in enzyme
on node 8.11.4 |
@lukeapage it's entirely possible that our dev scripts don't work on windows; could you share the code itself, and i can try to repro it? |
I did add a unit test - it will fail because I don't know exactly what the function output is. its a class that passes a function callback, shallow rendered and passed to jest's toMatchSnapshot
and its the snapshot serializer which uses the display name during serialization. |
Thanks, I'll give that a shot. |
What's the "snapshot serializer" here? enzyme doesn't have snapshot support - only |
I'm going to merge this, since i still think these are good fixes - but I'm pretty confident your issue is that you're relying on non-enzyme snapshotting. If you stick with |
- [fix] `debug`: prevent unavailable React types from matching `undefined` types (#1793)
- [fix] `debug`: prevent unavailable React types from matching `undefined` types (#1793)
We haven't quite yet upgraded to react 16.4 and with 16.3 Profiler is not defined, meaning that any react nodes without a type (like a function) in shallow get serialized as
<Profiler/>
Its not that important but I thought it could happen in the future, so I did a small refactor to not match undefined and undefined.