Skip to content
This repository was archived by the owner on Mar 16, 2019. It is now read-only.

Testing- TypeError: Cannot read property 'DocumentDir' of undefined #383

Closed
Sam1301 opened this issue Jun 3, 2017 · 3 comments
Closed

Comments

@Sam1301
Copy link

Sam1301 commented Jun 3, 2017

I am running jest unit tests, and I get the following error:

Test suite failed to run

    TypeError: Cannot read property 'DocumentDir' of undefined
      
      at Object.<anonymous> (node_modules/react-native-fetch-blob/fs.js:24:24)
      at Object.<anonymous> (node_modules/react-native-fetch-blob/index.js:21:9)

I went through all the previous similar issues but couldn't find a way to get rid of this error. The library is linked correctly and the app is functioning normally.
Is there any strategy you guys suggest for testing? Maybe updating the readMe could be helpful.

For reference:
RNProject: https://github.com/Sam1301/zulip-mobile/tree/fetch-blob-test
version: 0.10.5

Thanks.

@Sam1301
Copy link
Author

Sam1301 commented Jun 3, 2017

#212 was helpful

@ajurav1
Copy link

ajurav1 commented Aug 17, 2018

Hello i have solved this issue---- when you install the react-native-fetch-blob and link with iOS, it only provide limited lib on native side.

you can to open project from iOS in Xcode then remove the library of RNFetchBlob.xcodeproj from library folder and then again add by right click on library folder from node modules-->react-native-fetch-blob--->iOS folder --->add project RNFetchBlob.xcodeproj then all required file will be there and make sure add lib on build phases also libRNFetchBlob.a

it works for me.

Thanks

@jainkuniya
Copy link

Thanks for tracking this down :)
Today, i also got stuck on the same issue, this saved my time 😍

jainkuniya added a commit to jainkuniya/zulip-mobile that referenced this issue Oct 3, 2018
No logical change, just code refactor. Refer zulip#3018 to know the
motivation behind this.

Create mock `DocumentDir` method for `react-native-fetch-blob` to pass
jest test cases
(wkh237/react-native-fetch-blob#383).
gnprice pushed a commit to zulip/zulip-mobile that referenced this issue Oct 11, 2018
No logical change, just code refactor. Refer #3018 to know the
motivation behind this.

Create mock `DocumentDir` method for `react-native-fetch-blob` to pass
jest test cases
(wkh237/react-native-fetch-blob#383).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants