react-nativedetox

Is there any pre-defined flag from detox that I can know App is running on detox?


I'm looking for some pre-defined flag (macro) so I can skip a specific code in my App when I run detox.

if (__RUNNING_ON_DETOX__) {
  return; // skip this function
}

As a workaround, I'm using react-native-config and put ENVFILE on detox build. But I'm looking for a simpler way. If there is no flag that is provided from detox, I like to know the way that I could inject an inline export at least.

Thanks.


Solution

  • No predefined flag, but you can mock out the dependency that you don't want to interact with instead: