flickr / yakbak

Record and playback HTTP responses
MIT License
1.06k stars 84 forks source link

How to use it with React Native? #45

Closed Monte9 closed 3 years ago

Monte9 commented 6 years ago

I am hoping to use Yakbak along with Detox (integration testing framework) for React Native.

I understand that since this package is built for node.js applications it assumes access to node.js core modules such as assert and fs etc

I was able to get around this by using node-libs-browser which provides these core node.js modules in a React Native environment.

Although I am running into trouble with fs package. Here is the error I get:

error: bundling failed: Error: Unable to resolve module `fs` from `pillow_app/node_modules/yakbak/lib/record.js`: Module does not exist in the module map

So in the record.js file it does this var fs = require('fs'); although the only way to get access to the native filesystem in React Native is through this var fs = require('react-native-fs');

Hence I was wondering if anyone had any thoughts on how to resolve this or a possible workaround to get Yakbak working in React Native?

Monte9 commented 6 years ago

@cjcaj I saw your comment on the detox repo and would appreciate any input or suggestions on how to handle this.

https://github.com/wix/detox/issues/252#issuecomment-325391934