Skip to content
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

ignoreDefaultProps should work for forwardRef components as well #165

Merged

Conversation

bradbarrow
Copy link
Contributor

This PR addresses an issue I found when I wrapped a component in React.forwardRef and it's defaultProps appeared in my snapshots despite me having ignoreDefaultProps set.

To handle this, I've added the react-is library which was explicitly developed by the React JS team to handle this sort of type checking more robustly.

I've written tests and ensured that existing tests don't fail.

@codecov
Copy link

codecov bot commented Jan 31, 2020

Codecov Report

Merging #165 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #165   +/-   ##
=======================================
  Coverage   97.19%   97.19%           
=======================================
  Files           6        6           
  Lines         107      107           
  Branches       41       41           
=======================================
  Hits          104      104           
  Misses          3        3
Impacted Files Coverage Δ
src/shallow.js 100% <ø> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d1f86ee...a6ac1dc. Read the comment docs.

@adriantoine
Copy link
Owner

adriantoine commented Jan 31, 2020

@bradbarrow Hi! Thank you very much for your contribution, this PR looks really good, I'll merge it now and publish a new version today.

@adriantoine adriantoine merged commit b3eb5c7 into adriantoine:master Jan 31, 2020
@adriantoine
Copy link
Owner

It's published in enzyme-to-json@3.4.4 🎉

@bradbarrow
Copy link
Contributor Author

Thanks for the quick turn around @adriantoine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants