iOS
React Native Harness supports running tests on iOS Simulators and physical iOS devices.
Installation
First, install the Apple platform package:
Configuration
Import the Apple platform utilities in your rn-harness.config.mjs:
Simulators
To run on an iOS Simulator, use the appleSimulator() helper. You must provide both the device name and the iOS runtime version.
Finding Simulator Details
You can list all available simulators using xcrun:
Xcode often installs multiple runtime versions (e.g., iOS 17.0 and iOS 18.0). Since a simulator is uniquely identified by the combination of Device Type + Runtime, Harness needs both to target the correct simulator instance.
Physical Devices
To run on a connected physical iOS device, use the applePhysicalDevice() helper.
Physical iOS devices always connect to the default Metro port (8081). Custom metroPort values and automatic port fallback are supported on simulators, but not on physical iOS devices.
Requirements
- Xcode: Xcode must be installed on your system.
- xcrun: Harness uses
xcrun simctlfor simulators andxcrun devicectlfor physical devices. - Development Build: A debug build of your app must be installed on the simulator or device.
App Launch Options
Apple runners support appLaunchOptions.arguments and appLaunchOptions.environment.
Harness maps them differently depending on the target:
- iOS Simulator: arguments are passed to
simctl launch, and environment variables are passed throughSIMCTL_CHILD_* - iOS physical device: arguments are passed to
devicectl device process launch, and environment variables are passed with--environment-variables
Native Crash Details
Harness uses separate crash-monitoring implementations by target:
- iOS simulators can report startup and runtime crashes with matching crash details when those reports are available on your machine.
- iOS physical devices can report native crash details as part of the failure output when the connected device provides matching diagnostics.
Native crash details are attached to startup and execution failures when Harness can match the failing process from these sources. When the report contains it, Harness prints the extracted crashing-thread stack trace in the failure output.
