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

Remove jest-expo plugin on eject and use jest-react-native instead #473

Merged
merged 3 commits into from
Jan 19, 2018

Conversation

KELiON
Copy link
Contributor

@KELiON KELiON commented Nov 10, 2017

Resolve #47

When I run npm run eject and try to run jest tests by npm test, it fails with Cannot find module 'expo' from 'setup.js'. So we have to remove expo jest preset and use react-native instead.

I'm not sure if it is ok to replace it with jest-react-native for everyone but in my case removing jest-expo and using jest-react-native fixed the issue


pkgJson.scripts.start = 'react-native start';
pkgJson.scripts.ios = 'react-native run-ios';
pkgJson.scripts.android = 'react-native run-android';

pkgJson.jest.preset = 'react-native';
Copy link
Member

Choose a reason for hiding this comment

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

I think this is probably fine in 99.9% of the cases, but since we are here making changes, maybe we want to verify that the preset is set to "jest-expo" before we change it. if it is not, then we might want to skip the change and warn the user

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@brentvatne sounds good! What information would you add in this warning? I don't have any idea)

Copy link
Contributor

Choose a reason for hiding this comment

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

Warning: it looks like you've changed the Jest preset from jest-expo to ${pkjJson.jest.preset}. We recommend you make sure this Jest preset is compatible with ejected apps.

Something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks good @anp!

@KELiON KELiON changed the title [WIP] Remove jest-expo plugin on eject and use jest-react-native instead Remove jest-expo plugin on eject and use jest-react-native instead Jan 17, 2018
@brentvatne brentvatne merged commit fcc9629 into expo:master Jan 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove jest-preset-expo on eject
3 participants