Skip to main content
Version: 20.x

Environment Setup

The Introduction section walks you through setting up Detox in your project, one step at a time.

You will find that some steps are longer than the others: some are a couple of paragraphs, while the others look like a dedicated multistep guide. Bear with us - it is all necessary, and once set up, it is easy to move forward with writing tests at a high pace.

Please select type of your mobile application before you start the tutorial:

Detox was built from the ground up to support "classic" React Native projects.

Note

While Detox should work out of the box with almost any React Native version from the past few minor releases, official support is provided for React Native versions 0.71.x, 0.72.x and 0.73.x without React Native's "New Architecture".

Newer versions, as well as React Native's "New Architecture", may work with Detox, but have not been tested out yet by the Detox team.

Although we do not officially support older React Native versions, we do our best to keep Detox compatible with them.

Also, in case of a problem with an unsupported version of React Native, please submit an issue or write us in our Discord server and we will do our best to help out.

React Native CLI Quickstart

Your first step would be to complete the 📚 React Native CLI Quickstart Guide for iOS/Android/both (depending on your use case).

Note

Mind that for Android, we have an equivalent environment setup guide, which is a bit different, but more comprehensive. Use your judgement and take what's most suitable for your environment from both guides. For example, there is more than one way to install the right Java Development Kit.

RN Env

Open the link above and switch there to React Native CLI Quickstart tab to see the interactive tutorial for Development OS and Target OS of your choice.

Follow all the steps (yes, even if you have a native app!) and make sure you can create and run React Native apps on virtual testing devices.

RN Env Done

Detox Prerequisites

To complete the environment setup, you still have 2 steps ahead: installing detox-cli and applesimutils.

1. Command Line Tools (detox-cli)

detox-cli is merely a script that passes commands through to a local Detox executable located at node_modules/.bin/detox, making it easier to operate Detox from the command line, e.g. detox test -c ios.sim.debug.

It should be installed globally, enabling usage of the command line tools outside your npm scripts:

npm install detox-cli --global

On the other hand, if you are fine with running Detox commands with npx detox ..., you may skip installing detox-cli.

2. [MacOS Only] applesimutils

This tool is required by Detox to work with iOS simulators. The recommended way to install applesimutils is via Homebrew:

brew tap wix/brew
brew install applesimutils
Note

Make sure to periodically update your version of applesimutils to the latest version.

Now, when your environment is ready, let's move to the next section, Project Setup.