-
-
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
_cheerio2.default.load is not a function #309
Comments
Seeing the same thing with Jest, see #286 |
I remember running into this error with webpack (not using karma). I cannot remember what I did specifically to fix it but here are the parts of my webpack config for testing to getting cheerio working:
Maybe one of these addresses the issue. I do not include Update 2016-04-15: upgrading to React 15 needed to add: |
Ok, using the
Oh man, making enzyme work with webpack/karma is so frustrating. |
I think our issue might be distinct and Jest related - it seems like Jest's mocking behaviour could be causing our problem. Despite unmocking Enzyme, Cheerio appears to be mocked. |
I have never seen that |
@erwingaitano any solution? |
Having the same problem and error message as @erwingaitano I finally could make it work (using react 0.14).
Reduced the externals object to:
And added Hope this would help someone with the same problems in the future because it took me a while to figure it out. |
Just FYI, this solution from @valgreens for 0.14 also works for React 15. |
@valgreens thanks for sharing your solution. very similar to what I did to compile enzyme's test files with webpack to run with karma (#421). the reason for most of the awkwardness of using enzyme with webpack is due to the conditional |
The workaround @valgreens posted works for me on 15, except that I still need all of the React excludes. |
I don't think this is relevant any more now that we're on v3. |
I just encountered this when calling |
@jshado1 If you could file a new issue, and include your webpack config (since that's likely the culprit), that'd be helpful. |
Turns out I didn't actually need |
I'd appreciate any help with this: I'm using webpack + karma for my tests and did the setup as indicated in the installation guides. But when I try to use
enzyme.render(reactElement)
I got that error. This is mykarma.config.js
:and
component.test.js
:The text was updated successfully, but these errors were encountered: