You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`--harnessRunner <name>`| Specify which runner from your `rn-harness.config.mjs` to use. **Note:** Only one runner can be specified per command execution. |
36
-
|`--config, -c <path>`| Path to your Harness Jest configuration (defaults to `jest.harness.config.mjs`). |
|`--harnessRunner <name>`| Specify which runner from your `rn-harness.config.mjs` to use. **Note:** Only one runner can be specified per command execution. |
37
+
|`--config, -c <path>`| Path to your Harness Jest configuration (defaults to `jest.harness.config.mjs`). |
38
+
|`--metroPort <port>`| Set the preferred Metro port for this run. If the selected runner supports it and the port is busy, Harness will try the next available ports automatically. |
37
39
38
40
### Running on Multiple Platforms
39
41
@@ -66,6 +68,7 @@ To ensure stability and compatibility with real native devices, React Native Har
66
68
Harness executes tests **serially** (one at a time) on the target device to prevent native resource conflicts (like multiple tests trying to access the camera or filesystem simultaneously).
67
69
68
70
The following Jest flags are **ignored or disabled**:
71
+
69
72
-`--maxWorkers`
70
73
-`--runInBand` (Implicitly always true)
71
74
-`--maxConcurrency`
@@ -76,6 +79,7 @@ The following Jest flags are **ignored or disabled**:
76
79
Harness manages the test environment, transformation, and module resolution internally to ensure tests can be bundled by Metro and run on-device.
77
80
78
81
The following Jest configuration flags are **disabled**:
|`entryPoint`|**Required.** Path to your React Native app's entry point file. |
92
+
|`appRegistryComponentName`|**Required.** Name of the component registered with AppRegistry. |
93
+
|`runners`|**Required.** Array of test runners (at least one required). |
94
+
|`defaultRunner`| Default runner to use when none specified. |
95
+
|`host`| Hostname or IP address to bind the Metro server to (default: Metro default). |
96
+
|`metroPort`|Preferred port used by Metro and Harness bridge traffic (default: `8081`). Harness falls back to the next available port when this one is already in use.|
97
+
|`platformReadyTimeout`| Platform-ready timeout in milliseconds (default: `300000`). |
98
+
|`bridgeTimeout`| Bridge timeout in milliseconds (default: `60000`). |
99
+
|`bundleStartTimeout`| Bundle start timeout in milliseconds (default: `60000`). |
100
+
|`resetEnvironmentBetweenTestFiles`| Reset environment between test files (default: `true`). |
101
+
|`detectNativeCrashes`| Detect native app crashes during startup and test execution (default: `true`). |
102
+
|`crashDetectionInterval`| Interval in milliseconds to check for native crashes (default: `500`). |
103
+
|`disableViewFlattening`| Disable view flattening in React Native (default: `false`). |
104
+
|`coverage`| Coverage configuration object. |
105
+
|`coverage.root`| Root directory for coverage instrumentation (default: `process.cwd()`). |
106
+
|`forwardClientLogs`| Forward console logs from the app to the terminal (default: `false`). |
107
+
|`unstable__enableMetroCache`| Enable Metro transformation cache under `.harness/metro-cache` and log when reusing it (default: `false`). |
108
108
109
109
## Test Runners
110
110
111
+
:::info Metro Port Fallback
112
+
Harness treats `metroPort` as the preferred starting port. If that port is already in use, Harness tries the next available ports automatically and logs the port it selected for the run.
113
+
114
+
Physical iOS devices are the exception: they always use the default Metro port and do not support custom or fallback ports.
115
+
:::
116
+
111
117
A test runner defines how tests are executed on a specific platform. React Native Harness uses platform-specific packages to create runners with type-safe configurations.
112
118
113
119
Runner-specific launch options belong inside each runner config via `appLaunchOptions`.
Copy file name to clipboardExpand all lines: website/src/docs/platforms/ios.mdx
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,10 +43,11 @@ applePlatform({
43
43
FEATURE_X:'1',
44
44
},
45
45
},
46
-
})
46
+
});
47
47
```
48
48
49
49
#### Finding Simulator Details
50
+
50
51
You can list all available simulators using `xcrun`:
51
52
52
53
```bash
@@ -72,9 +73,11 @@ applePlatform({
72
73
FEATURE_X:'1',
73
74
},
74
75
},
75
-
})
76
+
});
76
77
```
77
78
79
+
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.
80
+
78
81
## Requirements
79
82
80
83
-**Xcode**: Xcode must be installed on your system.
0 commit comments