đ§Ē ZUnit
ZUnit is a unit testing framework for Zsh projects, maintained by the Z-Shell organization for the wider Zi/Z-Shell ecosystem.
It provides a concise @test syntax inspired by Bats,
a rich assertion library, per-test @setup/@teardown hooks, TAP output, HTML
reports, and a zunit init scaffolding command for fast project setup.
Documentation sectionsâ
| Section | What it covers |
|---|---|
| Installation | Manual install, dependencies, Zi integration |
| Test Syntax | @test, @setup/@teardown, helper functions |
| Assertions | All ~25 assertion functions with examples |
| Running Tests | CLI usage, flags, output modes |
| Configuration | .zunit.yml key reference |
| CI Integration | GitHub Actions and Travis CI workflows |
Quick startâ
# 1. Install
git clone https://github.com/z-shell/zunit.git
cd zunit && ./build.zsh && cp ./zunit /usr/local/bin
# 2. Scaffold a new project
cd my-project
zunit init
# 3. Write a test (tests/example.zunit)
# #!/usr/bin/env zunit
# @test 'addition works' {
# assert 2 equals 2
# }
# 4. Run
zunit
tip
Run zunit init --github-actions to generate a ready-to-use GitHub Actions
workflow in .github/workflows/zunit.yml alongside the project scaffold.