An open API service indexing awesome lists of open source software.

https://github.com/survivorbat/huhtest

huhtest is a work-in-progress test library for your huh forms
https://github.com/survivorbat/huhtest

cli cobra command go golang huh huhtest stdin stdout test unit unittest

Last synced: about 2 months ago
JSON representation

huhtest is a work-in-progress test library for your huh forms

Awesome Lists containing this project

README

          

# ๐Ÿค” Huh Test

`huhtest` is a work-in-progress test library for your [huh](https://github.com/charmbracelet/huh) forms.
If you're - for some reason - eager to test your huh-based interactive CLI applications then you've come to
the right place.
It works by matching messages in a form's output (stdout) and then sending pre-programmed text to the form's input (stdin).

It's not 100% bug-free, as some combinations of groups and selects seem to have off-by-one errors.

## โฌ‡๏ธ Installation

`go get github.com/survivorbat/huhtest`

## ๐Ÿ“‹ Usage

Check out [this example](./examples_test.go)

## ๐Ÿงช Testing

To make sure this thing actually works, we have both unit tests and integration tests, the former
checks the output of `huhtest` directly, the latter actually uses `huh` to check whether the inputs
are properly processed.

## ๐Ÿž Debugging

There's a `.Debug()` method available that enabled extra logging in the `Responser`. If you
encounter a bug or are suspicious about something not working, turn it on to see exactly what it's doing.

## ๐Ÿ”ญ Plans

- Custom keymap support for select fields
- Select fields should preferably be selected by output text and not index