-
Notifications
You must be signed in to change notification settings - Fork 64
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
Exclude forward ref when using deep mount #167
Exclude forward ref when using deep mount #167
Conversation
Codecov Report
@@ Coverage Diff @@
## master #167 +/- ##
=======================================
Coverage 97.19% 97.19%
=======================================
Files 6 6
Lines 107 107
Branches 41 41
=======================================
Hits 104 104
Misses 3 3
Continue to review full report at Codecov.
|
Hi @adriantoine. Just a friendly ping - I was wondering if you had a chance to review this. |
If not, ping me, I'll do it. My only concern is that this PR will break existing snapshot... |
Hey @VincentLanglet, just following up on this. Yes, this PR would definitely break existing snapshots. It would be limited to those using mount with deep mode on components using forward refs. However, from reading the documentation, this new behavior is the expected behavior of deep mode. Would it be worth making an option to opt out of this change via configuration? |
Sorry for the delay. |
@mmarcuccio 3.5.0 is released. |
When using deep mount on a component wrapped with a forwardRef, currently enzyme-to-json includes the forwardRef node in the JSON.
Running the test included here without the added check for forwardRef results in the following snapshot:
Since the deep mode should only include DOM nodes, this PR adds a check to exclude the forwardRef node but include the output of the wrapped component.