Skip to content

[Feature] Expand unit tests for InstallPods command to cover pod path discovery and error handling #2678

@ConnorQi01

Description

@ConnorQi01

Summary

The InstallPods command (src/extension/commands/installPods.ts) contains substantial logic for discovering the pod executable across multiple Ruby environment paths (rbenv, rvm, Homebrew, system Ruby) and for providing contextual error suggestions across six distinct failure scenarios. The existing test file (test/extension/commands/installPods.test.ts) only covers platform gating and directory validation — the core logic is untested.

Why this is useful

Without tests for pod path discovery and error handling, regressions in the most complex parts of the command go undetected. The command was added in 1.13.2 and is the primary way users install CocoaPods dependencies from the extension; broken path resolution silently falls back to no-op behavior.

Suggested scope

  • Add tests for findPodExecutable(): verify each lookup path (rbenv, rvm, Homebrew, system) is tried in order and the first found path is returned
  • Add tests for the six contextual error hint branches (missing CocoaPods, CDN issues, Xcode, Ruby, permissions, gem problems) to confirm the correct suggestion string is included in the error output
  • Add a test for the environment variable injection (PATH, RBENV_ROOT, SHELL, locale) passed to the pod subprocess

Evidence

  • src/extension/commands/installPods.ts: findPodExecutable() tries ~8 candidate paths; baseFn() maps error message substrings to six contextual hint branches
  • test/extension/commands/installPods.test.ts: only two test suites exist — Platform checks and Directory validation; no tests for path discovery or error handling
  • Command added in 1.13.2 (#2520); no follow-up test expansion has occurred since

Validation

  • Run npm test (unit test suite) and confirm new tests pass on macOS and are skipped gracefully on other platforms
  • Verify no existing tests regress

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    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