1 unstable release
0.1.0 | Mar 2, 2025 |
---|
#149 in Testing
147 downloads per month
100KB
2K
SLoC
Yamori
Yamori is a test runner and visualizer for command-line applications. It allows you to define tests in TOML or YAML format and visualize the results in a terminal UI or run them in CLI mode.
Features
- Define tests in TOML or YAML format
- Run commands with arguments and input
- Compare actual output with expected output
- Visualize test results in a terminal UI or simple CLI output
- Support for timeouts
- Support for pre-build commands
- Per-test build configuration
- Color-coded test results
- Test history tracking
Installation
From Crates.io
cargo install yamori
From Source
# Clone the repository
git clone https://github.com/nwiizo/yamori.git
cd yamori
# Build and install
cargo install --path .
Quick Start
# Run in TUI mode
yamori --yamori-config tests/configs/tests.toml
# Run in CLI mode
yamori --cli --yamori-config tests/configs/tests.toml
# Using environment variable
YAMORI_CONFIG=tests/configs/tests.toml yamori
Usage
TUI Mode (Default)
You can run Yamori with a specific configuration file using one of the following methods:
-
Using the
-y
or--yamori-config
flag:yamori --yamori-config tests/configs/tests.yaml
-
Using the
YAMORI_CONFIG
environment variable:YAMORI_CONFIG=tests/configs/tests.yaml yamori
The environment variable takes precedence over the command-line flag if both are specified.
CLI Mode
You can run Yamori in CLI mode (without the TUI interface) using the -c
or --cli
flag:
yamori --cli --yamori-config tests/configs/tests.yaml
Or with the environment variable:
YAMORI_CONFIG=tests/configs/tests.yaml yamori --cli
In CLI mode, Yamori will run all tests and display a compact summary of the results. Only failed tests will show detailed information. This is useful for CI/CD pipelines or when you want a quick overview of test results.
Configuration Format
Yamori supports both TOML and YAML configuration files. The file format is automatically detected based on the file extension (.toml
, .yaml
, or .yml
).
Example Configuration (TOML)
# Global build configuration
[build]
release = false
pre_build_commands = ["echo 'Global build preparation'"]
# Test definitions
[[tests]]
name = "Echo Test"
command = "echo"
args = ["Hello, World!"]
expected_output = "Hello, World!"
timeout_secs = 5
[tests.build]
release = false
pre_build_commands = ["echo 'Preparing Echo Test'"]
[[tests]]
name = "Word Count Test"
command = "wc"
args = ["-w"]
input = "This is a test sentence with exactly eight words."
expected_output = "8"
timeout_secs = 5
Key Bindings (TUI Mode)
In the terminal UI:
q
: Quit?
: Toggle helpj
or Down Arrow: Move downk
or Up Arrow: Move uph
or Left Arrow: Previous tabl
or Right Arrow: Next tabr
: Re-run testsb
: Toggle release modeR
: Run tests in release modeH
: Toggle history viewEsc
: Close help/popup
Documentation
For detailed documentation, please see:
Project Structure
yamori/
├── src/ # Source code
├── docs/ # Documentation
├── scripts/ # Helper scripts
├── examples/ # Example applications
└── tests/
└── configs/ # Test configuration files
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
Dependencies
~10–20MB
~303K SLoC