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

Adds native to the list of jest-react-native platforms to fix testing with react-relay. #11179

Conversation

chollier
Copy link
Contributor

See jestjs/jest#2170. Per @cpojer's request, bringing this PR to react-native as well.

Summary

When using jest with React Native and Relay and recommended default settings, jest throws :

    Cannot find module 'react-dom' from 'relayUnstableBatchedUpdates.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:151:17)
      at Object.<anonymous> (node_modules/react-relay/lib/relayUnstableBatchedUpdates.js:15:18)
      at new RelayEnvironment (node_modules/react-relay/lib/RelayEnvironment.js:39:63)

Investigating this, I found out that https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json didn't have "native" in the list of platforms, hence jest can't pick up relayUnstableBatchedUpdates.native.js in react-relay.

Test plan

I copied and paste the content of https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json in my package.json jest section, as well as removed the preset entry. Same result.
I then did :

-       "platforms": ["android", "ios"],
+      "platforms": ["android", "ios", "native"],

This fixes the issue.

@facebook-github-bot
Copy link
Contributor

By analyzing the blame information on this pull request, we identified @cpojer and @kentaromiura to be potential reviewers.

@facebook-github-bot facebook-github-bot added GH Review: review-needed CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. labels Nov 28, 2016
@facebook-github-bot
Copy link
Contributor

@cpojer has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

robclouth pushed a commit to robclouth/react-native that referenced this pull request Dec 7, 2016
… with react-relay.

Summary:
See jestjs/jest#2170. Per cpojer's request, bringing this PR to react-native as well.

**Summary**

When using jest with React Native and Relay and recommended default settings, jest throws :
```
    Cannot find module 'react-dom' from 'relayUnstableBatchedUpdates.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:151:17)
      at Object.<anonymous> (node_modules/react-relay/lib/relayUnstableBatchedUpdates.js:15:18)
      at new RelayEnvironment (node_modules/react-relay/lib/RelayEnvironment.js:39:63)
```

Investigating this, I found out that https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json didn't have "native" in the list of platforms, hence jest can't pick up `relayUnstableBatchedUpdates.native.js` in react-relay.

**Test plan**

I copied and paste the content of https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json in my `package.json` `jest` section, as well a
Closes facebook#11179

Differential Revision: D4243073

Pulled By: cpojer

fbshipit-source-id: bcfeb2235df4d466ba19d0a3fe94fc98835a20ea
DanielMSchmidt pushed a commit to DanielMSchmidt/react-native that referenced this pull request Jan 4, 2017
… with react-relay.

Summary:
See jestjs/jest#2170. Per cpojer's request, bringing this PR to react-native as well.

**Summary**

When using jest with React Native and Relay and recommended default settings, jest throws :
```
    Cannot find module 'react-dom' from 'relayUnstableBatchedUpdates.js'

      at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:151:17)
      at Object.<anonymous> (node_modules/react-relay/lib/relayUnstableBatchedUpdates.js:15:18)
      at new RelayEnvironment (node_modules/react-relay/lib/RelayEnvironment.js:39:63)
```

Investigating this, I found out that https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json didn't have "native" in the list of platforms, hence jest can't pick up `relayUnstableBatchedUpdates.native.js` in react-relay.

**Test plan**

I copied and paste the content of https://github.com/facebook/jest/blob/master/packages/jest-react-native/jest-preset.json in my `package.json` `jest` section, as well a
Closes facebook#11179

Differential Revision: D4243073

Pulled By: cpojer

fbshipit-source-id: bcfeb2235df4d466ba19d0a3fe94fc98835a20ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants