Skip to content

[Feature] Add unit tests for RunMacOS and RunWindows command flow #2882

Description

@ConnorQi01

Summary

The RunMacOS and RunWindows commands in src/extension/commands/runMacOs.ts and src/extension/commands/runWindows.ts had no unit tests. Android, EAS, and iOS run command coverage now exists; macOS and Windows were the remaining gaps.

Why this is useful

Consistent test coverage across all platform run commands reduces regression risk. Both commands share the same onBeforeExecute structure (resolve RN versions, check platform support, fire a TipNotificationService update) as the already-tested Android and iOS commands. RunMacOS also swallows errors from the platform setup phase (try/catch in baseFn), a subtle behavior covered explicitly by the new tests.

Suggested scope

  • Add test/extension/commands/runMacOs.test.ts covering RunMacOS
    • Happy path: versions resolved, platform operations called in order
    • onBeforeExecute: checks REACT_NATIVE_MACOS package and calls checkTargetPlatformSupport
    • Platform setup failures are silently swallowed, runApp still proceeds
  • Add test/extension/commands/runWindows.test.ts covering RunWindows
    • Happy path: versions resolved, platform operations called in order
    • onBeforeExecute: checks REACT_NATIVE_WINDOWS package and calls checkTargetPlatformSupport
    • Platform errors are not swallowed; failure in any step rejects the command
  • Follow the same proxyquire and sinon stub pattern as the Android and iOS command tests

Evidence

Validation

  • npm run build
  • npm test (340 tests, 339 passing, 1 pending)

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