mardi 24 mai 2016

Configure Mocha/Babel to resolve React Native platform extensions?

I'm using Mocha with react-native-mock to run tests on React Native applications. However, I'm having issues when running tests on components which import platform-specific files, e.g. require('./MyComponent') resolves to MyComponent.android.js when running on Android. I'd like to be able to configure Mocha or Babel (whichever is appropriate) to be able to resolve these requires based on some configuration, e.g. an environment variable.

I'm aware of another solution which involves adding another file manually, but I'm specifically looking for something that automates this.

Aucun commentaire:

Enregistrer un commentaire