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

Add warning about implicit dependency on react-addons-test-utils #228

Merged

Conversation

thatjessicakelly
Copy link
Contributor

A warning like this should hopefully help with #225.

Not exactly sure what the text should say.

@lelandrichardson
Copy link
Collaborator

Hmm. This is a good idea. we should do this for all of the implicit dependencies. We could link to the README of the repo for more context as well

'Please add the appropriate version to your devDependencies. ' +
'See https://github.com/airbnb/enzyme/issues/225'
);
throw e;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh this should probably process.exit(1) rather than rethrowing the error

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think error is better. Enzyme can be run in browser-based test runners

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, very true, this is fine then

@ljharb
Copy link
Member

ljharb commented Mar 3, 2016

How many other implicit non-peer deps are there?? ideally we have as close to zero as possible

@lelandrichardson
Copy link
Collaborator

We are in this situation because of 0.13 and 0.14 compatibility...

If you are using React 0.13, then you are all good. react is all you need, and react is a dep.
If you are using React 0.14, then you need to have react, react-dom, and react-addons-test-utils.

Since react-dom and react-addons-test-utils are packages that cannot be installed alongside react 0.13, we need to have implicit dependencies.

@ljharb
Copy link
Member

ljharb commented Mar 3, 2016

I wonder if making them optionalDependencies would be any better - i'm not sure how that field interacts with npm

@lelandrichardson
Copy link
Collaborator

@ljharb optionalDependencies won't work. We tried that first, and shit blew up if you tried to use enzyme with 0.13

@ljharb
Copy link
Member

ljharb commented Mar 3, 2016

ah right, i'd forgotten. in that case this try/require/catch pattern is probably the cleanest way forward - maybe we could put all of those in one file (either one group or one per weird-dep) that re-exports either the libs or undefined, and require that module where they're needed?

@thatjessicakelly
Copy link
Contributor Author

Let me know how you want me to handle it and I'm happy to update this

@lelandrichardson
Copy link
Collaborator

@ljharb i feel like there is already enough misdirection with the react-compat file. This file is already dealing with the differences between 0.13 and 0.14, so putting this logic here I think is sane.

@thatjessicakelly, do you think you could just update your PR to do the same thing for react-dom in addition to react-addons-test-utils?

@ljharb
Copy link
Member

ljharb commented Mar 4, 2016

Makes sense.

@thatjessicakelly
Copy link
Contributor Author

Done. I also linked to the README

lelandrichardson added a commit that referenced this pull request Mar 6, 2016
Add warning about implicit dependency on react-addons-test-utils
@lelandrichardson lelandrichardson merged commit 8ded8b2 into enzymejs:master Mar 6, 2016
@capaj
Copy link

capaj commented Nov 18, 2016

@thatjessicakelly you keep using that word "warning", yet you throw an error. Interesting.

@ljharb
Copy link
Member

ljharb commented Nov 18, 2016

@capaj that tone is not appreciated. Conceptually it's a warning, so by a technical definition of English, it's correct. You will not do well playing the condescending pedantry game here.

@capaj
Copy link

capaj commented Nov 18, 2016

condescending pedantry game here

ok 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants