webdriverio / webdriverio/desktop-mobile

React Native standalone: Metro orphaned — shared session factory never calls launcher.onComplete()

Open
#657 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

scope:native-mobile-core scope:react-native type:bug
Dominant language
TypeScript
Stars
13
Forks
6
Avg merge
2d 3h
Merged PRs (30d)
33

Description

Standalone mode only (driving the service outside the WDIO testrunner via createMobileSession; normal testrunner runs are fine because WDIO calls onComplete itself).

The shared factory packages/native-mobile-core/src/session.ts never references onComplete: its MobileLauncherLike contract declares only onPrepare, and cleanup() calls service.after() + browser.deleteSession() but never launcher.onComplete(). React Native's launcher owns Metro (packages/react-native-service/src/launcher.ts #metro, started in onPrepare under manageMetro), stopped only in onComplete()#stopMetro().

Result: with manageMetro, Metro (port 8081) is orphaned on cleanup() and on remote()/before() startup failure — a superset of the tauri standalone bug (#636), since it also leaks on the happy path.

Fix (in native-mobile-core): add onComplete to MobileLauncherLike and call it — guarded so it can't mask the original error (ideally surfaced via AggregateError) — in the remote()-failure path, the service.before()-failure path, and in cleanup(). No-ops safely for Flutter (its launcher spawns nothing).

Related: #636 (the tauri fix this mirrors), #445 (standalone coverage/contract).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/native-mobile-core/src/session.ts and compare the MobileLauncherLike contract and cleanup(), remote(), and service.before() failure paths with packages/react-native-service/src/launcher.ts, especially Metro startup and onComplete(). Ensure launcher completion is invoked safely on all specified paths without masking the original error, then add or update standalone coverage referenced by #445.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile, testing
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
78/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.