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 have no unit tests. All major platform run commands (Android, EasBuild) have recently been covered; macOS and Windows are the remaining gap.

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 command, making these tests straightforward to add and high-value for catching regressions. RunMacOS also swallows errors from the platform setup phase (try/catch in baseFn) — a subtle behavior worth explicitly documenting with a test.

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 (try/catch), 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 + sinon stub pattern as test/extension/commands/runAndroid.test.ts

Evidence

  • src/extension/commands/runMacOs.ts — 53 lines, no corresponding test file
  • src/extension/commands/runWindows.ts — 48 lines, no corresponding test file
  • test/extension/commands/runAndroid.test.ts established the proxyquire pattern (merged in [Feature] Add unit tests for RunAndroid command flow #2852)
  • test/extension/commands/runEasBuild.test.ts and others confirm the project is actively filling command test coverage
  • find test/extension/commands -name "runMacOs*" -o -name "runWindows*" returns nothing

Validation

  • npm run test:unit (or the equivalent mocha suite) passes with the new test files
  • Both happy-path and error-propagation cases covered for each command

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