Overview of Interactive CLI Snapshot Testing
mainThe new snapshot testing solution replaces the legacy steps.json/snap.txt system with a PTY-backed (Pseudo-Terminal) runner. It uses a vt100 screen emulator to run CLI commands in a real terminal environment, allowing for the testing of interactive elements like prompts, pickers, spinners, and watch modes.
Key features include:
- Scripted Interactions: Test cases can send keystrokes (arrows, enter, ctrl-c, etc.) and synchronize on specific render milestones.
- Markdown Snapshots: Results are stored as Markdown files containing rendered terminal screens.
- Real Assertions: Unlike the old runner, mismatches trigger a test failure with a unified diff.
- Process Isolation: Each test case runs with its own
VP_HOME, cleared environment, and controlledPATHto prevent cross-case interference.