Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Feature] Add unit tests for recently added Expo and packager commands #2684

Description

@ConnorQi01

Summary

Several commands added in v1.13.x — including ConfigEASBuild, Prebuild, EnableHermes, KillPort, LaunchIosSimulator, and RnDoctor — have no unit test coverage. The pattern established by installPods.test.ts and cleanRestartPackager.test.ts can be directly applied to cover these commands.

Why this is useful

Without unit tests, regressions in these commands are only caught by smoke tests or user reports. Adding focused unit tests for each command's guard conditions, error paths, and happy-path behaviour improves reliability and makes future refactors safer.

Suggested scope

  • Add test/extension/commands/configEASBuild.test.ts — covers: non-Expo project rejection, existing eas.json early return, successful eas build:configure execution
  • Add test/extension/commands/enableHermes.test.ts — covers: missing Podfile guard, Android vs iOS branch, hermes flag update logic
  • Add test/extension/commands/killPort.test.ts — covers: empty input no-op, valid port dispatches correct npx kill-port call
  • Add test/extension/commands/prebuild.test.ts — covers: correct npx expo prebuild invocation
  • Follow the Sinon stub pattern already used in installPods.test.ts (stub vscode.window, CommandExecutor, ChildProcess)

Evidence

  • src/extension/commands/ contains 40 command files; test/extension/commands/ covers only 3 (commands.test.ts, cleanRestartPackager.test.ts, installPods.test.ts)
  • configEASBuild.ts, prebuild.ts, enableHermes.ts, killPort.ts were all added in v1.13.x but have no corresponding test files
  • Recent commits (e128e533, 87875f0f) show the team is actively adding per-command unit tests — this continues that pattern

Validation

  • npm test or gulp test should pass with the new test files
  • Each test file should run independently without requiring a real VS Code window or device

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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