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. #2170

Merged

Conversation

chollier
Copy link
Contributor

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.

@codecov-io
Copy link

codecov-io commented Nov 26, 2016

Current coverage is 88.57% (diff: 100%)

Merging #2170 into master will not change coverage

@@             master      #2170   diff @@
==========================================
  Files            39         39          
  Lines          1409       1409          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
  Hits           1248       1248          
  Misses          161        161          
  Partials          0          0          

Powered by Codecov. Last update 841efa1...bba5a45

@cpojer cpojer merged commit abab68b into jestjs:master Nov 28, 2016
@cpojer
Copy link
Member

cpojer commented Nov 28, 2016

Thank you! Can you make the same change to react-native here: https://github.com/facebook/react-native/blob/master/jest-preset.json#L4 – we are actually merging the preset into react-native at the moment! :)

@chollier
Copy link
Contributor Author

will do

facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Nov 29, 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 #11179

Differential Revision: D4243073

Pulled By: cpojer

fbshipit-source-id: bcfeb2235df4d466ba19d0a3fe94fc98835a20ea
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
tushardhole pushed a commit to tushardhole/jest that referenced this pull request Aug 21, 2017
@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants