๐งช ZUnit
ZUnit is a unit testing framework for Zsh projects, maintained by the Z-Shell organization. It brings 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.
Run zunit init --github-actions to generate a ready-to-use GitHub Actions workflow alongside the project scaffold โ CI from day one.
Documentationโ
Installation
Manual install, build from source, dependencies, and Zi integration.
Test Syntax
@test, @setup/@teardown hooks, and helper functions.
Assertions
All ~25 assertion functions with examples โ equals, contains, match, status.
Running Tests
CLI usage, flags, TAP output, HTML reports, and filtering.
Configuration
.zunit.yml key reference โ directories, TAP, HTML, time limits.
CI Integration
GitHub Actions and Travis CI workflow examples ready to drop in.
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