Skip to content

[Feature] Add unit tests for RunIOS command flow #2859

Description

@ConnorQi01

Summary

The RunIosDevice and RunIosSimulator commands in src/extension/commands/runIos.ts have no unit tests, while the equivalent RunAndroid command just received full test coverage in #2852.

Why this is useful

Consistent test coverage across the major platform run commands reduces regression risk, especially around the onBeforeExecute logic that resolves React Native package versions and checks platform support before running. The iOS path is commonly used and small regressions there are hard to catch without tests.

Suggested scope

  • Add test/extension/commands/runIos.test.ts covering RunIosDevice and RunIosSimulator
  • Test happy path: workspace selected, versions resolved, platform run proceeds
  • Test onBeforeExecute cancellation (user cancels workspace selection)
  • Test onBeforeExecute when TargetPlatformHelper.checkTargetPlatformSupport throws
  • Follow the same mock structure used in test/extension/commands/runAndroid.test.ts

Evidence

  • src/extension/commands/runIos.ts defines RunIosDevice and RunIosSimulator with a shared onBeforeExecute that resolves RN versions and checks platform support — no test coverage exists today
  • test/extension/commands/runAndroid.test.ts was added in commit 67941493 and serves as the direct structural pattern to follow
  • test/extension/commands/launchIosSimulator.test.ts covers only the emulator picker flow, not the runIos platform commands themselves

Validation

  • Unit tests should pass under gulp test-unit
  • Cancellation and error paths should align with the runAndroid.test.ts structure

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions