ZUnit is a powerful unit testing framework for ZSH.
This repository is maintained by the Z-Shell organization as the active workspace mirror used by the wider Zi/Z-Shell ecosystem. Historical upstream links are preserved where they still describe the original project, while runtime integrations continue to follow the currently published package coordinates used across the ecosystem.
Note: The install snippets below intentionally reference
zdharma/zunitandzdharma/revolver— those are the package coordinates that zplug, Homebrew, and related tooling still resolve at runtime. Thez-shell/zunitrepository (where this README and the CI badges live) is the active development mirror; thezdharma/*names are preserved to avoid breaking existing user configurations.
The Z-Shell mirror validates the project with GitHub Actions using native tests, Zsh syntax checks, and a scheduled Zsh compatibility matrix. The matrix follows the versions used by the surrounding Z-Shell test infrastructure so downstream projects can rely on the same compatibility baseline.
WARNING: Although the majority of ZUnit's functionality works as expected, it is in the early stages of development, and as such bugs are likely to be present. Please continue with caution, and report any issues you may have.
zulu install zunitNOTE: In versions of Zulu prior to
1.2.0, there is an additional step required after install:
cd ~/.zulu/packages/zunit
./build.zsh
zulu link zunitZUnit and its dependencies can all be installed with zplug.
zplug 'zdharma/revolver', \
as:command, \
use:revolver
zplug 'zdharma/zunit', \
as:command, \
use:zunit, \
hook-build:'./build.zsh'brew install zunit-zsh/zunit/zunitgit clone https://github.com/zdharma/zunit
cd ./zunit
./build.zsh
chmod u+x ./zunit
cp ./zunit /usr/local/binZUnit requires Revolver to be installed, and in your
$PATH. The zulu or homebrew installation methods will install this dependency for you.
Tests in ZUnit have a simple syntax, which is inspired by the BATS framework.
#!/usr/bin/env zunit
@test 'My first test' {
# Test contents here
}The body of each test can contain any valid ZSH code. The zunit shebang #!/usr/bin/env zunit MUST appear at the top of each test file, or ZUnit will not run it.
To bootstrap a new project with a current CI example, run:
zunit init --github-actionsFor a full breakdown of ZUnit's syntax and functionality, check out the official documentation.
All contributions are welcome, and encouraged. Please read our contribution guidelines and code of conduct for more information.
Copyright (c) 2016 James Dinsdale hi@molovo.co (molovo.co)
ZUnit is licensed under The MIT License (MIT)
