Fix web and vega platform runner init signature mismatch - #175
Merged
Conversation
The harness session calls each platform runner's default export as module.default(config, harnessConfig, init), but the web and vega runners only declared (config, init?), so harnessConfig landed in the init slot and init.signal.aborted threw "Cannot read properties of undefined (reading 'aborted')" during session setup. Both runners now declare (config, harnessConfig, init) with init required, matching platform-ios and platform-android. A shared HarnessPlatformRunnerFactory<TConfig, THarnessConfig> type in @react-native-harness/platforms is applied to all four runners so this class of signature drift fails to typecheck instead of throwing at runtime.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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?
The web and Vega platforms failed to start: session setup threw
TypeError: Cannot read properties of undefined (reading 'aborted')before any test could run.
How does it work?
The harness session invokes each platform runner's default export as
module.default(config, harnessConfig, init). The web and Vegarunners only declared
(config, init?), soharnessConfiglanded inthe
initslot andinit.signal.abortedthrew on a value that wasactually the harness config, not the init options. Both runners now
declare
(config, harnessConfig, init)withinitrequired, matchingplatform-iosandplatform-android. A sharedHarnessPlatformRunnerFactory<TConfig, THarnessConfig>type in@react-native-harness/platformsis applied to all four platformrunners so a signature mismatch like this fails to typecheck instead
of throwing at runtime. New unit tests in
platform-webandplatform-vegaassert the runner arity matches the session's callshape and exercise the abort-signal handling end to end.
Why is this useful?
The web and Vega platforms are usable again, and the shared factory
type turns a class of runtime crash into a compile-time error for
every current and future platform runner.
Note for reviewers:
@react-native-harness/cache:testhas apre-existing, unrelated failure in
boundary.test.ts(a cache-pathboundary check flagging
bundler-metro/src/metro-block-list.ts) thatreproduces on
mainand is untouched by this change.