Skip to content

Migrate to vitest: interaction + snapshot chains #282

Description

@thymikee

Step 2 of 4: Drop test-only DI with vitest module mocking

Migrate the two independent handler trees that thread dispatch through every function.

Files to migrate (~25 DI params removed)

Interaction chain

src/daemon/handlers/interaction.ts (2 optional params)

  • Remove dispatch?: typeof dispatchCommand, readAndroidScreenSize?: typeof getAndroidScreenSize

src/daemon/handlers/interaction-touch.ts (2 optional + 3 required threaded)

  • Remove dispatch? and readAndroidScreenSize? from handleTouchInteractionCommands
  • Remove dispatch? from normalizeSwipeCoordinates
  • Remove required dispatch: typeof dispatchCommand from internal functions (3 occurrences) — these become direct imports

src/daemon/handlers/interaction-common.ts (3 required threaded)

  • Remove dispatch: typeof dispatchCommand from 3 internal functions — direct import instead

src/daemon/handlers/interaction-read.ts (1 required threaded)

  • Remove dispatch: typeof dispatchCommand — direct import

src/daemon/handlers/interaction-selector.ts (1 required threaded)

  • Remove dispatch: typeof dispatchCommand — direct import

Tests to rewrite: __tests__/interaction.test.ts and related

Snapshot chain

src/daemon/handlers/snapshot.ts (3 optional params)

  • Remove dispatchSnapshotCommand?, runnerCommand?, sessionlessRunnerCleanup?

src/daemon/handlers/snapshot-wait.ts (2 optional + 3 required threaded)

  • Remove dispatchSnapshotCommand?, runnerCommand?
  • Remove required dispatchSnapshotCommand from 3 internal functions

src/daemon/handlers/snapshot-alert.ts (1 optional)

  • Remove runnerCommand?: typeof runIosRunnerCommand

src/daemon/handlers/snapshot-capture.ts (1 required threaded)

  • Remove dispatchSnapshotCommand: typeof dispatchCommand — direct import

Tests to rewrite: __tests__/snapshot-handler.test.ts and related

Validation

  • pnpm typecheck
  • Both test runners pass
  • dispatch as a threaded param is gone from all non-session code

Depends on #281. Part of migration: #1→**#2**→#3#4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions