Skip to content

[Feature] Add unit tests for InstallPods command #2793

Description

@ConnorQi01

Summary

The InstallPods command (src/extension/commands/installPods.ts) has 257 lines of logic but no dedicated unit test file. It contains several well-isolated, independently testable code paths that are not covered by the existing smoke tests.

Why this is useful

Unit tests would guard against regressions in the platform guard, directory validation, pod discovery, and error suggestion logic — all without requiring a macOS environment or a real CocoaPods installation.

Suggested scope

  • Test non-darwin platform early exit (warns and returns without executing)
  • Test missing ios/ directory handling (logs error, shows error message, returns)
  • Test missing Podfile handling (logs error, shows error message, returns)
  • Test findPodCommand(): returns a known path when a file exists and is executable, falls back to "pod" when nothing is found
  • Test getSuggestionForError(): each error-keyword branch returns the expected suggestion string
  • Follow the proxyquire / sinon stub pattern used in stopPackager.test.ts and cleanRestartPackager.test.ts

Evidence

  • Source: src/extension/commands/installPods.ts — added in v1.13.2, grown to 257 lines with three private helpers (findPodCommand, getEnhancedEnvironment, getSuggestionForError)
  • No test file exists under test/extension/commands/ for this command
  • The recent test-addition series has systematically covered startPackager, stopPackager, cleanRestartPackager, stopLogCatMonitor, prebuildClean, setNewArch, enableExpoHermesinstallPods is the natural next command in this series
  • CHANGELOG v1.14.1 confirms the test backfill initiative is active

Validation

  • Run npx mocha --config .mocharc.js test/extension/commands/installPods.test.ts (or equivalent test runner invocation) and confirm all new test cases pass

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions