Windows
React Native Harness runs tests against a deployed React Native Windows app.
Overview
Unlike Android and iOS, where Harness boots an emulator or simulator, the Windows runner works with an app you have already deployed to the machine. Harness resolves the app by its package identity, launches it, and tracks its process for the duration of the run. Build and deploy the app with react-native run-windows before invoking Harness.
Installation
Configuration
Import the Windows platform helper in your rn-harness.config.mjs:
Options
Finding the package identity
Open windows/<YourApp>/Package.appxmanifest and look at the Identity and Application elements:
Here packageName is MyApp and appId is App (the default).
Deploying the app
The Windows runner never builds — deploy the app first:
--no-launch registers the MSIX package without starting it (Harness starts it), and --no-packager keeps run-windows from starting its own Metro server on the port Harness wants.
Then run the tests:
Metro configuration
Harness applies the same out-of-tree platform wiring that react-native start does (the react-native → react-native-windows resolver redirect and the Windows InitializeCore), so a plain metro.config.js works — you do not need to add a windows case to resolver.resolveRequest or serializer.getModulesRunBeforeMainModule yourself.
Requirements
- Windows 10 or 11.
- The React Native Windows toolchain (Visual Studio with the C++ workload, the Windows SDK) to build the app.
- The app deployed via
react-native run-windowsbefore the run. - The harness Metro server reachable at the app's bundle URL (
http://localhost:8081by default). An RNW Debug build points there out of the box.
CI
The official GitHub Action supports the windows runner. Run the job on a windows-* runner, deploy the app in an earlier step, then invoke the action without an app input — see Running in CI/CD.
