Detox
02 / 02

Configuration, CI & Debugging

Detox: Configuration, CI & Debugging

detox.config.js

module.exports = {
  testRunner: { args: { $0: 'jest', config: 'e2e/jest.config.js' } },
  apps: {
    'ios.debug': {
      type: 'ios.app',
      binaryPath: 'ios/build/Build/Products/Debug-iphonesimulator/MyApp.app',
      build: 'xcodebuild -workspace ios/MyApp.xcworkspace -scheme MyApp -configuration Debug -sdk iphonesimulator',
    },
    'android.debug': {
      type: 'android.apk',
      binaryPath: 'android/app/build/outputs/apk/debug/app-debug.apk',
      build: 'cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug',
    },
  },
  devices: {
    simulator: { type: 'ios.simulator', device: { type: 'iPhone 15' } },
    emulator: { type: 'android.emulator', device: { avdName: 'Pixel_6_API_33' } },
  },
  configurations: {
    'ios.sim.debug': { device: 'simulator', app: 'ios.debug' },
    'android.emu.debug': { device: 'emulator', app: 'android.debug' },
  },
};

Running Tests

# Build the app in its TEST configuration first -- includes native
# Detox instrumentation that shouldn't ship in the production release
detox build -c ios.sim.debug

# Then run against the named configuration (app + device pairing)
detox test -c ios.sim.debug
detox test -c android.emu.debug

Artifacts & CI Integration

// detox.config.js -- capture debugging evidence automatically
module.exports = {
  artifacts: {
    plugins: {
      screenshot: { enabled: true, takeWhen: { testFailure: true } },
      video: { enabled: true },
      log: { enabled: true },
    },
  },
};
// A CI failure comes with a screenshot/video/log of what the app
// actually did at failure time -- far easier to diagnose than a
// bare stack trace, especially for failures hard to reproduce locally.

Detox vs Appium & the Testing Pyramid

  • Detox: gray-box, deep native synchronization, React-Native-focused -- strong automatic flakiness reduction for the apps it's built into.

  • Appium: black-box, WebDriver-based, framework-agnostic across app types/platforms -- more universal, but without Detox's automatic idle-detection.

  • E2E tests give the highest end-to-end confidence but run slower and cost more infrastructure than unit/component tests -- most suites favor many fast unit tests plus a smaller set of high-value E2E tests for critical flows.

Keep your own version of these notes — editable, searchable, and organised by your stack.

Start free