dcdpr / dcdpr/jp

Add PTY-based end-to-end CLI testing infrastructure

Open
#392 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Rust
Stars
16
Forks
3
Avg merge
1d 1h
Merged PRs (30d)
121

Description

Add infrastructure for testing interactive CLI features using pseudo-terminal (PTY) simulation.

Context

Currently, interactive prompts (jp_inquire, inquire) require a real TTY and cannot be tested automatically. While we can use dependency injection to test the logic around prompts, true end-to-end testing of the CLI's interactive behavior requires simulating terminal input/output.

Libraries like portable-pty or expectrl can create pseudo-terminals that allow injecting keystrokes and capturing output, enabling tests like:

  • Interrupt handling (Ctrl+C menus)
  • Tool permission prompts
  • Multi-select dialogs
  • Editor integration

Alternatives

Dependency injection at the prompt level (implemented separately) covers unit testing of prompt-adjacent logic but doesn't verify the actual terminal rendering or keystroke handling.

Proposed Implementation

  1. Evaluate portable-pty vs expectrl for our needs
  2. Create a test harness that spawns jp commands in a PTY
  3. Add helper functions for sending keystrokes and matching output
  4. Write e2e tests for critical interactive flows

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by evaluating portable-pty and expectrl for spawning jp commands and simulating terminal input/output. Build a PTY test harness with helpers for keystrokes and output matching, then add end-to-end coverage for interrupt handling, permission prompts, multi-select dialogs, and editor integration.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli, testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.