-
-
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 find module 'enzyme/build/ShallowTraversal' from 'shallow.js' #1143
Comments
It's likely that enzyme-to-json is not yet compatible with v3. It should be declaring a peer dep that should now be making |
@willdurand have you tried the enzyme-to-json 3.0.0 beta? It should provide Enzyme 3 and React 16 compatibility.
-act |
@actraiser enzyme v3.0 is now released, so no need for the beta. |
Interesting, no I did not try the beta version of This issue is not related to Enzyme per se so feel free to close it. Thanks both for your time/help! |
@ljharb for the sake of clarity, I was referring to the package enzyme-to-json. |
@actraiser aha, thanks for clarifying :-) my mistake, @willdurand thanks, closing. |
It does not work. I have the official React 16 and Enzyme 3 and I have no idea how and where to define Enzyme adapter. In the beginning of every unit test? In package.json? Is there ANY working example how to write a test using Enzyme, Jest and React 16?
And again...
In my package.json
|
@hipertracker please refer to the migration guide. The issue you're seeing is because the |
@aweary I double what @hipertracker saying. Where should we add these adapters? To each of the test? Or in some other place and import it? Or it will set enzyme config globally for all tests run. This part is very unclear. |
I am not sure if this is the best practise approach but what I did was to put an enzyme_setup.js file in my /helpers directory and included it in every script that requires enzyme with react. helpers/enzyme_setup.js
tests/Link/index.react.test.js
This works fine for me. If there is a different better approach, let me know. -act |
@actraiser you can use |
Quick thoughts: I am pretty sure your test runner (eg. Jest) has an option to run a script before everything else (pre-hook or something like that). I'll put the adapter code in it instead of Importing it in all test files. |
Yes. You're correct I did it this way. But I just pointed out that in docs
this is not 100% clear, so they better to improve that.
On Sep 27, 2017 12:57, "William Durand" <notifications@github.com> wrote:
Quick thoughts: I am pretty sure your test runner (eg. Jest) has an option
to run a script before everything else (pre-hook or something like that).
I'll put the adapter code in it instead of Importing it in all test files.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1143 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ADwe77uWQuBi3z-oWadUjFfb1i4FJEcqks5smioKgaJpZM4PkGv6>
.
|
good point @willdurand - I moved it now into the jest configuration part of my package.json
-act |
Just release |
When I'm run the test I have next Error: { |
If you're getting syntax errors then it's unrelated to enzyme. I think we just had another issue with "skew" in the last day or three, which was also not related to enzyme. |
Encountered this issue when upgrading an older project to Webpack 4. For future Googlers, upgrading to the latest
|
Other future googlers who tried going to the latest |
Yeah I got an error when tryng to use jest-serializer-enzyme, but if I use enzyme-to-json/serializer instead:
it works |
Thank you @grimunit & @erick2014 |
Hi,
Our test suite is now failing with the following error (Greenkeeper PR to upgrade from 2.9.1 to 3.0.0):
Is it something you are aware of? I thought that was because we did not have any adapter configured (cf. migration guide) but configuring one gave the same error locally, it seems. I did not find anything related to this error message so I am not sure what to do yet.
Thanks.
The text was updated successfully, but these errors were encountered: