-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Can't get simple test to work with Redux #660
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
Comments
Have you found a solution to this? |
@DenizUgur no not yet. Are you having same issue? |
Similar. It happens only when I try to generate a coverage report. |
I think I saw a thread about the coverage report issue somewhere |
@RyanAtViceSoftware I tested your code here and it worked, but I'm using a different version of @testing-library/react: 9.3.2. I didn't try it with 9.5.0, so I can't tell you if it's a version problem, but it's worth a try. |
I'm also facing same issue |
Unfortunately this has nothing to do with React Testing Library. You get the same issue when using ReactDOM directly: My guess is there's some tooling issue going on here. Everyone who's commented here is probably experiencing some variant on the same problem. If you update to the latest of jest/babel then this should probably go away. In any case, there's nothing we can do within React Testing Library because it's unrelated, so I'm going to close this issue. Good luck! |
I'm facing the same issue with ` "@testing-library/react": "^10.2.0", The render simply returns |
Figured out that I was mocking one of the dependencies of the component. After importing the asset it fixed my issue. |
@kentcdodds how can you say this is not related to React Testing Library?? React testing library is buggy, doesn't work, and you don't even care... SMH |
A good author would link to a working example of testing a react project with redux. It should not be that hard! I guess since it's not possible we should all go back to enzyme or move away from this soon-to-be-deprecated react testing library? 🤔 |
Unfortunately we do not have the bandwidth to show examples for every possible build config, such as the the "react-app-rewired" system in the reproduction repo. React Testing Library requires a working DOM context as a prerequisite, and so does Enzyme. This is usually set up via The Redux team maintains an extensive guide to how to test using RTL, including setting up We link to it here: https://testing-library.com/docs/example-react-redux Does that help? |
I had this error when my code contained Silly mistake, hopefully I can save someone the same trouble 😄 |
@testing-library/react
version:9.5.0
react
version:16.13.1
node
version:v12.13.0
npm
(oryarn
) version:6.14.5
Relevant code or config:
What you did:
Tried to wire up a basic test with react, redux and rtl.
What happened:
Got this error
Reproduction:
https://github.com/vicesoftware/react-redux-hooks-boilerplate/tree/testing-setup
cd webapp
npm install
npm test
webapp/src/_tests_/App.test.js
should failProblem description:
Because I can't test apps with redux.
Suggested solution:
Hopefully get this working. I'm guessing it's a config but probably helpful to have this issue solved so others can google the fix.
The text was updated successfully, but these errors were encountered: