-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
react-test-renderer/shallow render throws TypeError: Cannot read property 'current' of undefined #14763
Comments
The same problem |
for npm you can just install react-test-renderer in your package.json with specific version. We just fixed our problems with this solution. |
seems like it works with the latest react version 16.8.0. My previously used version 16.6.3 was failing, probably because the transitive react-test-renderer version was newer and it required something that was not present in the old react version. |
I think this is due to us splitting the current owner/dispatcher refs (#14548) Maybe we could do a bugfix release that patches backwards compat? |
To be clear: you can fix this problem if you use the same versions of |
@gaearon in our case react-test-renderer was installed by enzyme-adapter-react-16": "1.7.0 with fixed version. So on local machine with package.json.lock it was fine, but when you push your code in to cloud. It will install all from scratch and i don`t know why but it install last version of react-test-renderer . |
To be clear, an older version of the An older renderer will work with a newer version of the |
Possible fix #14770 |
We'll publish a bugfix release with this fix shortly |
Should be fixed by the latest 16.8.1 release |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. Your bug will get fixed much faster if we can run your code and it doesn't have dependencies other than React. Paste the link to your JSFiddle (https://jsfiddle.net/Luktwrdm/) or CodeSandbox (https://codesandbox.io/s/new) example below:
Run ShallowRenderers render method
What is the expected behavior?
render should return shallow render of the given component
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
"react": "16.6.3",
"react-test-renderer": "16.8.0",
"enzyme": "3.7.0",
"enzyme-adapter-react-16": "1.7.0",
"jest": "24.0.0"
Workaround is to add:
"resolutions": {
"react-test-renderer": "16.7.0"
}
(for yarn)
The text was updated successfully, but these errors were encountered: