feat: support running the harness on a Windows host - #186
Closed
StasDoskalenko wants to merge 1 commit into
Closed
Conversation
Two host-side assumptions broke React Native Windows before the harness could do anything useful: - The config reader passed a bare absolute path to dynamic import() for `.mjs` configs. Node only accepts a file:// URL there; on Windows the drive letter is read as a URL scheme and rejected (ERR_UNSUPPORTED_ESM_URL_SCHEME). Normalize with pathToFileURL. - getDeviceDescriptor threw "Unsupported platform" for Platform.OS === 'windows', aborting the bridge handshake. Add a `windows` case and widen the DeviceDescriptor platform union (in both the runtime and bridge copies of the type). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
@StasDoskalenko is attempting to deploy a commit to the Callstack Team on Vercel. A member of the Team first needs to authorize it. |
Author
|
Closed — this was opened against the wrong repo. It belongs on my fork for now. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is this?
Two fixes that let the Harness host process and runtime handle React Native
Windows. Neither adds a Windows platform runner yet — they remove the host-side
assumptions that make an RNW app fail before any platform-specific work could
run.
@react-native-harness/config— loading an ESMrn-harness.config.mjsfails on a Windows host. The reader passes a bare absolute path to dynamic
import(), and Node only accepts afile://URL there; on Windows the driveletter is parsed as a URL scheme and rejected with
ERR_UNSUPPORTED_ESM_URL_SCHEME.@react-native-harness/runtime/@react-native-harness/bridge—getDeviceDescriptor()throwsUnsupported platformforPlatform.OS === 'windows', which aborts the bridge handshake duringreportReady.How does it work?
pathToFileURL()beforeimport(). This is a no-op-shaped transform on POSIX (/abs→file:///abs), so the path is unchanged in behavior there and simply becomesvalid on Windows.
getDeviceDescriptor()gains awindowsbranch that reportsplatform: 'windows'with anosVersionread fromPlatform.constants(falling back to
''), and theDeviceDescriptorplatform union — declaredin both
runtimeandbridge— includes'windows'.Both packages gain unit coverage: the config reader is exercised loading
.mjs/.js/.jsonconfigs and walking up to a parent directory, andgetDeviceDescriptornow has a test per platform includingwindows.Why is this useful?
RNW is a first-class out-of-tree React Native platform. Today, running Harness
against an RNW app requires patching both of these in
node_modules. Foldingthem in removes the patches and is the smallest first step toward first-class
Windows support; the platform runner, out-of-tree Metro wiring, and CI are
separate follow-ups.
Note: the Harness test suite has some pre-existing POSIX-path assumptions in
@react-native-harness/bundler-metrotests (e.g.paths.test.tspasses anon-absolute-on-Windows path) that fail when the suite runs on a Windows host.
Those are untouched here and out of scope; CI runs on
ubuntu-latestand isunaffected.