Skip to content

[Feature] Add unit tests for PrebuildClean command #2755

Description

@ConnorQi01

Summary

PrebuildClean (src/extension/commands/prebuildClean.ts) has no unit tests, while its sibling command Prebuild already has test coverage in test/extension/commands/prebuild.test.ts. The two commands share the same structure — both use CommandExecutor, AppLauncher.getNodeModulesRootByProjectPath, and OutputChannelLogger.getChannel — but PrebuildClean is missing even a basic execution path test.

Why this is useful

Keeps Expo command test coverage consistent: every CommandExecutor-based command should verify that it calls the correct CLI command from the correct project root. A future refactor of prebuildClean.ts would silently regress without a test.

Suggested scope

  • Add test/extension/commands/prebuildClean.test.ts mirroring the structure of prebuild.test.ts
  • Verify that commandExecutor.execute is called with "npx expo prebuild --clean"
  • Verify the logger channel is opened with the "Expo Prebuild Clean" label
  • Verify that AppLauncher.getNodeModulesRootByProjectPath is called with the correct project root

Evidence

  • src/extension/commands/prebuildClean.ts — no corresponding test file exists
  • test/extension/commands/prebuild.test.ts — identical structure, already covered
  • git log --oneline -30 — steady pattern of adding sibling tests for each command (enableHermes → enableExpoHermes, prebuild → ?, cleanRestartPackager, etc.)

Validation

  • npm test passes with the new test file included
  • Test stubs confirm npx expo prebuild --clean is the exact string passed to execute

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