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

Enzyme and react-redux. v7 issues #41

Closed
th3fallen opened this issue Aug 18, 2020 · 5 comments
Closed

Enzyme and react-redux. v7 issues #41

th3fallen opened this issue Aug 18, 2020 · 5 comments

Comments

@th3fallen
Copy link

Describe the bug
react-redux is unable to get the store from context anymore when shallow mounted with your lib

To Reproduce
Steps to reproduce the behavior:

  1. Install latest react-redux, enzyme, jest
  2. attempt to run a previously passing test
  3. see that it can now no longer see the redux store
  4. Sob uncontrollably

Expected behavior
should be able to get the store from redux

Screenshots
If applicable, add screenshots to help explain your problem.

System information
Mac OSX, 10.5, latest, latest
OS Version, Node Version, Enzyme Version, React Version, etc.

Additional context

@minznerjosh
Copy link
Contributor

Sadly I think this is the same as #33. This is due to lack of support in enzyme for useContext, which react-redux uses enzymejs/enzyme#2176.

@minznerjosh
Copy link
Contributor

This is, no doubt, a controversial opinion, but at TrialSpark we almost never use shallow rendering. We find that, while using mount makes our test suite slower, the tests are more effective at actually catching bugs because mount more closely replicates the way our components are used in the real world. We tend to think of our enzyme tests less as unit tests and more as integration tests. If we do need to mock out a component (perhaps because it makes network requests on mount or something) we just use jest.mock().

@th3fallen
Copy link
Author

@minznerjosh thanks for the feedback, while that'll be a pain if it'll get my tests working I'll start that migration now.

@dschinkel
Copy link

dschinkel commented Sep 19, 2020

related enzymejs/enzyme#2449 however I'm not using hooks, but am using Redux 7 and having issues now with context and store in existing tests after upgrading to Redux 7

@naudo
Copy link

naudo commented Jun 19, 2024

We are moving to archive this repo as we no longer support it and am closing this issue as "won't fix".

If you're interested in maintaining this repo, please reach out!

@naudo naudo closed this as completed Jun 19, 2024
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

No branches or pull requests

4 participants