charmbracelet / charmbracelet/vhs
Testing for expected stdout/stderr/tty and exit status
- Dominant language
- Go
- Stars
- 20.9k
- Forks
- 480
- Avg merge
- 4d 1h
- Merged PRs (30d)
- 2
Description
**Is your feature request related to a problem? Please describe.**
I'd like to use VHS to test my CLI applications to ensure the output and exit status is as expected. Currently this does not seem supported.
**Describe the solution you'd like**
```
Set Shell bash
Output confirm.gif
Type "confirm --positive --ppid=$$ -- 'testing ctrl+c'"
Sleep 1s
Enter
Sleep 1s
Ctrl+C
Sleep 1s
Expect ExitStatus Failure # aka != 0
Expect TTY "testing ctrl+c ABORT
Terminated: 15"
```
**Describe alternatives you've considered**
So far I've been using https://github.com/bevry/dorothy/blob/master/commands/eval-tester for this, which is working well enough. However I was hoping I could use VHS also for testing failure conditions.
**Additional context**
Can't reproduce as any vhs playback is failing for me: https://github.com/charmbracelet/vhs/issues/350
Contributor guide
Research direction
Start by reading the proposed VHS script and the linked issue #350 about playback failures. Identify how VHS currently handles shell playback, then define support for checking stdout, stderr, TTY output, and exit status, including failure conditions; done means the example expectations can run reliably.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bash, go
- Domain
- cli, testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100