-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Cannot directly mount Context.Consumer
without console error
#1751
Comments
Closely related: #1737. |
We don't yet have proper support for React's new context. Thanks for the report. |
This might be useful: https://github.com/kevingrandon/enzyme |
@tyrsius since enzyme v3.4 (and all the resulting adapters) have been released, I don't believe there's any functionality in that package that isn't in enzyme proper, and there's many more fixes included in actual enzyme. |
I tried reproducing this error just now according to the included instructions, but both tests seem to pass just fine. @wchargin Are you still seeing this bug? If so, would you mind upgrading to [email protected] & [email protected] and letting me know if it's still a problem? I'm using the general adapter for react 16 (not 16.3), but upgrading to the latest version of enzyme and the adapter seems to have resolved #1737. |
@rimunroe: Strange, indeed. I can’t reproduce it, either. I don’t
Unfortunately, I can’t answer the question: I’ve had to stop using |
This issue should definitely be addressed because of a propType fix in the mount wrapper, fwiw. |
The original repro was correct. However, The following {
"license": "MIT",
"dependencies": {
"enzyme": "3.4.1",
"enzyme-adapter-react-16.3": "1.0.0",
"jest": "23.5.0",
"prettier": "^1.14.2",
"react": "16.3.2",
"react-dom": "16.3.3"
},
"resolutions": {
"enzyme-adapter-utils": "1.5.0"
}
} (Edited to remove valid but unnecessary dependency in The fact that the test passes on latest versions (without the explicitly |
If
Context
is the result ofReact.createContext
(React 16.3+), thenit appears that
mount
can handleContext.Consumer
s that appear inthe tree, but raises a console error if the root itself is a consumer
(despite appearing to otherwise behave correctly).
The same error occurs with the v16.3 adapter or the v16 adapter.
The error message is:
Here is a repro:
Reproduce by running
yarn jest
with the followingpackage.json
:Versions: node v8.9.4, npm v5.6.0, yarn v1.7.0, Mint 18.2 (Ubuntu 18.04)
The text was updated successfully, but these errors were encountered: