Skip to content

refactor(test/lib): generalize run-process harness into cli-process#28253

Merged
kitlangton merged 1 commit into
devfrom
worktree-cli-harness-generalize
May 18, 2026
Merged

refactor(test/lib): generalize run-process harness into cli-process#28253
kitlangton merged 1 commit into
devfrom
worktree-cli-harness-generalize

Conversation

@kitlangton
Copy link
Copy Markdown
Contributor

Quick rename PR. The run-process harness landed in #28230 covering only the run command, but the fixture itself (env isolation + tmpdir + TestLLMServer + subprocess spawn) is CLI-generic. Renaming makes the file name match the eventual scope and sets up follow-ups (smoke tests across the CLI surface) to land without a rename round.

Changes

  • test/lib/run-process.tstest/lib/cli-process.ts (git rename preserves history)
  • withRunFixturewithCliFixture
  • RunFixtureCliFixture
  • runItcliIt
  • The one consumer (test/cli/run/run-process.test.ts) updated to match

Kept the names that are still useful:

  • OpencodeCli interface
  • RunOpts / RunResult types (RunResult is the shape every spawn returns; RunOpts is specific to the run builder)
  • opencode.run / opencode.spawn / opencode.expectExit / opencode.parseJsonEvents

What this enables

A TODO inside OpencodeCli documents the next addition: long-lived builders for serve / acp will need a return-handle shape (yielding .url / .kill from a Scope). Those land per-command as they're needed.

Motivation

A future Effect CLI migration needs behavioral-parity tests across the full CLI surface. This rename is the cheapest possible step toward that — the harness is ready to host coverage for any subcommand without per-PR renaming churn.

Verified

  • bun typecheck — clean
  • bun run test test/cli/run/run-process.test.ts — 4/4 green in ~10s

Net diff

Mechanical: 1 file renamed, 1 consumer updated, ~10 lines changed inside the renamed file.

The run-process harness was named for the one command it covered, but the
fixture (env isolation + tmpdir + TestLLMServer + subprocess spawn) is
generic — it can host tests for any opencode subcommand. Renaming makes
the surface match the eventual scope.

Mechanical:
- test/lib/run-process.ts → test/lib/cli-process.ts (git rename preserves
  history)
- withRunFixture → withCliFixture
- RunFixture → CliFixture
- runIt → cliIt
- The one consumer (test/cli/run/run-process.test.ts) updated to match.

Kept as-is because they're still command-specific or still useful:
- OpencodeCli (the interface)
- RunOpts / RunResult (specific to opencode.run, but RunResult is the
  shape every spawn returns)
- opencode.run / opencode.spawn / opencode.expectExit /
  opencode.parseJsonEvents

A TODO inside OpencodeCli documents the next step: adding long-lived
builders (opencode.serve, opencode.acp) needs a different return shape
than the short-lived run/spawn — they need to yield a handle with
.url / .kill that lives in the surrounding Scope. Will be added when the
first long-lived command gets test coverage.

Motivation: a future Effect CLI migration needs behavioral-parity tests
across the full CLI surface. This rename sets up the harness to host
that coverage without a rename in every follow-up PR.

Verified: bun typecheck clean, 4/4 existing tests pass in ~10s.
@kitlangton kitlangton merged commit 7b8a103 into dev May 18, 2026
10 of 12 checks passed
@kitlangton kitlangton deleted the worktree-cli-harness-generalize branch May 18, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant