1.2.3 • Published 1 year ago

react-native-is-detox v1.2.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

react-native-is-detox

Checks whether current app instance is launched by Detox or not

Installation

yarn add react-native-is-detox

Usage (async)

import { isDetox } from 'react-native-is-detox';

// ...

const result = await isDetox();

console.log('Was app launched by Detox?', result);
import { isDetox } from 'react-native-is-detox';

function App() {
  useEffect(() => {
    isDetox().then((result) => {
      console.log('Was app launched by Detox?', result);
    });
  }, []);

  return <MyApp />;
}

Usage (sync)

import { isDetoxSync } from 'react-native-is-detox';

const result = isDetoxSync();

console.log('Was app launched by Detox?', result);
import { isDetoxSync } from 'react-native-is-detox';

function App() {
  useEffect(() => {
    const result = isDetoxSync();
    console.log('Was app launched by Detox?', result);
  }, []);

  return <MyApp />;
}

Mock module in Jest

Import react-native-is-detox/jestSetup in your Jest setup file.

import 'react-native-is-detox/jestSetup';

Credits

Original solution by Simon Buchan from this comment.

License

MIT

1.2.3

1 year ago

1.2.2

1 year ago

1.2.1

1 year ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago