Skip to content

The @nx/detox plugin provides various executors to help you create and configure detox projects within your Nx workspace. Below is a complete reference for all available executors and their options.

build

Run detox build options.

Options

OptionTypeDescriptionDefault
configPathstringSpecify Detox config file path. If not supplied, detox searches for .detoxrc[.js] or detox section in package.json.
detoxConfigurationstringSelect a device configuration from your defined configurations, if not supplied, and there’s only one configuration, detox will default to it.

test

Run detox test options.

Options

OptionTypeDescriptionDefault
detoxConfigurationstring [required]Select a device configuration from your defined configurations, if not supplied, and there’s only one configuration, detox will default to it.
appLaunchArgsnumberCustom arguments to pass (through) onto the app every time it is launched.
artifactsLocationstringArtifacts (logs, screenshots, etc) root directory.
buildTargetstringTarget which builds the application.
captureViewHierarchystring[iOS Only] Capture *.uihierarchy snapshots on view action errors and device.captureViewHierarchy() calls.
cleanupbooleanShutdown simulator when test is over, useful for CI scripts, to make sure detox exists cleanly with no residue
colorbooleanColors in log output
configPathstringSpecify Detox config file path. If not supplied, detox searches for .detoxrc[.js] or detox section in package.json.
debugSynchronizationbooleanCustomize how long an action/expectation can take to complete before Detox starts querying the app why it is busy. By default, the app status will be printed if the action takes more than 10s to complete.
deviceBootArgsstringCustom arguments to pass (through) onto the device (emulator/simulator) binary when booted.
deviceLaunchArgsstringA list of passthrough-arguments to use when (if) devices (Android emulator / iOS simulator) are launched by Detox.
deviceNamestringOverride the device name specified in a configuration. Useful for running a single build configuration on multiple devices.
forceAdbInstallbooleanDue to problems with the adb install command on Android, Detox resorts to a different scheme for install APK’s. Setting true will disable that and force usage of adb install, instead.
gpuboolean[Android Only] Launch Emulator with the specific -gpu [gpu mode] parameter.
headlessbooleanAndroid Only] Launch Emulator in headless mode. Useful when running on CI.
inspectBrkbooleanUses node’s --inspect-brk flag to let users debug the jest/mocha test runner
jestReportSpecsboolean[Jest Only] Whether to output logs per each running spec, in real-time. By default, disabled with multiple workers.
keepLockFilebooleanKeep the device lock file when running Detox tests.
loglevelstringLog level: fatal, error, warn, info, verbose, trace.
recordLogsstringSave logs during each test to artifacts directory. Pass failing to save logs of failing tests only.
recordPerformancestring[iOS Only] Save Detox Instruments performance recordings of each test to artifacts directory.
recordTimelinestring[Jest Only] Record tests and events timeline, for visual display on the chrome://tracing tool.
recordVideosstringSave screen recordings of each test to artifacts directory. Pass failing to save recordings of failing tests only.
retriesnumber[Jest Circus Only] Re-spawn the test runner for individual failing suite files until they pass, or <N> times at least.
reusebooleanReuse existing installed app (do not delete + reinstall) for a faster run.false
runnerConfigstringTest runner config file, defaults to e2e/mocha.opts for mocha and e2e/config.json for Jest.
takeScreenshotsstringSave screenshots before and after each test to artifacts directory. Pass failing to save screenshots of failing tests only.
useCustomLoggerbooleanUse Detox’ custom console-logging implementation, for logging Detox (non-device) logs. Disabling will fallback to Node.js / test-runner’s implementation (e.g. Jest / Mocha).
workersnumberSpecifies number of workers the test runner should spawn, requires a test runner with parallel execution support (Detox CLI currently supports Jest).