Skip to content
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

Adding enzyme to React 16+ requires you to eject because you can't configure Jest further #3268

Closed
wldcordeiro opened this issue Oct 11, 2017 · 2 comments

Comments

@wldcordeiro
Copy link

Is this a bug report?

Nope

Which terms did you search for in User Guide?

Enzyme

Environment

  1. node -v: 8.4.0
  2. npm -v:
  3. yarn --version (if you use Yarn): 1.2.0
  4. npm ls react-scripts (if you haven’t ejected): 1.0.14

Then, specify:

  1. Operating system: OS X
  2. Browser and version (if relevant):

Expected Behavior

You can get a basic Enzyme setup without having to eject.

Actual Behavior

Adding enzyme to React 16+ requires you to eject because you can't configure Jest further to get enzyme's adapters setup.

@gaearon
Copy link
Contributor

gaearon commented Oct 12, 2017

you can't configure Jest further to get enzyme's adapters setup.

This is not correct. CRA has always supported running some code before every test:

https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#initializing-test-environment

Here is an example of working setup:

#3199 (comment)

Somebody should send a PR to Enzyme to document usage with CRA, and update our docs as well.

@gaearon
Copy link
Contributor

gaearon commented Oct 12, 2017

I filed an issue for updating the docs.
#3272

@gaearon gaearon closed this as completed Oct 12, 2017
@lock lock bot locked and limited conversation to collaborators Jan 21, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants