Skip to content

[Feature] Add unit tests for LaunchExpoWeb command #2827

Description

@ConnorQi01

Summary

The LaunchExpoWeb command in src/extension/commands/launchExpoWeb.ts has no dedicated unit tests. It has two meaningful paths: non-Expo projects return without starting anything, while Expo managed projects create an ExponentPlatform and run the web packager preparation/start sequence.

Why this is useful

A regression in Expo project detection or the web packager startup sequence could break the Expo Web command without being caught by the current command tests. Dedicated unit coverage would verify both the early-return behavior and the successful launch path without requiring a real Expo project.

Suggested scope

  • Add test/extension/commands/launchExpoWeb.test.ts using the existing proxyquire + Sinon command-test pattern.
  • Stub OutputChannelLogger, ExponentPlatform, getRunOptions, and the project Expo helper.
  • Test: isExpoManagedApp(true) returns false → no platform is created and no packager methods are called.
  • Test: isExpoManagedApp(true) returns truebeforeStartPackager() and startPackager() are called in order.
  • Verify the platform receives Expo Web run options and the project packager.

Evidence

  • src/extension/commands/launchExpoWeb.ts contains the Expo detection and startup flow.
  • No test/extension/commands/launchExpoWeb.test.ts exists.
  • No existing issue or PR references launchExpoWeb test coverage.

Validation

  • Run targeted formatting/lint checks for the new test.
  • Run npm run build.
  • Run npm test and confirm the new suite passes.

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