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

Jest Native Events #8

Open
sam-n-johnston opened this issue Dec 14, 2016 · 0 comments
Open

Jest Native Events #8

sam-n-johnston opened this issue Dec 14, 2016 · 0 comments

Comments

@sam-n-johnston
Copy link

This package works great and thanks a lot for that!

The problem I have is when I try to run tests with Jest on my code. When I run the tests, I get the following error message:

Invariant Violation: Native module cannot be null.

      at invariant (node_modules\fbjs\lib\invariant.js:38:15)
      at new NativeEventEmitter (node_modules\react-native\Libraries\EventEmitter\NativeEventEmitter.js:32:1)
      at Object.<anonymous> (node_modules\@remobile\react-native-file-transfer\libs\FileTransfer.js:29:63)
      at Object.<anonymous> (node_modules\@remobile\react-native-file-transfer\index.js:2:20)

The line in my code that is the culprit is: import FileTransfer from '@remobile/react-native-file-transfer'
I've tried mocking the the module with Jest, but this does not fix the error.

The problem is caused by line 29 in FileTransfer.js: var EventEmitter = Platform.OS==="android"?DeviceEventEmitter:new NativeEventEmitter(NativeModules.FileTransfer);

Can anyone help me with this error?
Thanks.

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

No branches or pull requests

1 participant