GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - TypedDevs/bashunit: A simple yet powerfull testing library for bash scripts.

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace
BranchesTags
Open more actions menu

Latest commit

 

History

3,342 Commits
3,342 Commits

Folders and files

NameName
Last commit message
Last commit date
.agnostic-ai
.agnostic-ai
 
 
.github
.github
 
 
adrs
adrs
 
 
bin
bin
 
 
completions
completions
 
 
docs
docs
 
 
example
example
 
 
src
src
 
 
tests
tests
 
 
tools
tools
 
 
.bashunitrc
.bashunitrc
 
 
.editorconfig
.editorconfig
 
 
.env.example
.env.example
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
.nvmrc
.nvmrc
 
 
.shellcheckrc
.shellcheckrc
 
 
.worktreeinclude
.worktreeinclude
 
 
CHANGELOG.md
CHANGELOG.md
 
 
LICENSE
LICENSE
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
action.yml
action.yml
 
 
agnostic-ai.yaml
agnostic-ai.yaml
 
 
bashunit
bashunit
 
 
bpkg.json
bpkg.json
 
 
build.sh
build.sh
 
 
install.sh
install.sh
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
release.sh
release.sh
 
 
shell.nix
shell.nix
 
 

Repository files navigation

Tests Static analysis Editorconfig checker npm version MIT Software License


bashunit

A simple testing framework for bash scripts

Write and run tests for your Bash scripts.

Why bashunit

A testing framework for Bash 3.0+. It ships 93 assertions plus spies, mocks, data providers, snapshots and more.

Quick start

Install the latest version into your project:

curl -s https://bashunit.com/install.sh | bash

Write a test in tests/example_test.sh:

#!/usr/bin/env bash

function test_bashunit_is_working() {
  assert_same "bashunit is working" "bashunit is working"
}

Run it:

./lib/bashunit tests/

Assertions at a glance

The table shows one example from each assertion family. See all assertions and signatures, or run bashunit doc locally:

Family Example
Equality & truth assert_equals "foo" "$actual"
Strings assert_string_starts_with "Hello" "$greeting"
Exit codes assert_exit_code "1" (checks $? of the previous command)
Numeric assert_greater_than "1" "$count"
Arrays assert_array_length 3 "${my_array[@]}"
Files & dirs assert_file_permissions 644 "$file"
JSON (needs jq) assert_json_contains ".name" "bashunit" "$json"
Dates assert_date_before "2026-01-01" "$date"
Duration assert_duration_less_than "echo hello" 500
Snapshots assert_match_snapshot "$(my_cmd)"
Test doubles assert_have_been_called_times 2 my_fn

Documentation

Installation instructions, feature references, and examples are at bashunit.com.

Shell tab-completion for bash and zsh is available under completions/. See the installation docs.

The AI agent guide covers machine-readable results and API mistakes that let generated tests pass without checking the intended behavior. Plain-text docs are available at llms.txt and llms-full.txt, with an agent skill at bashunit-skill.md.

Contribute

Issues, ideas and pull requests are welcome. See the contribution guide to set up your environment.

About

A simple yet powerfull testing library for bash scripts.

bashunit.com/

Topics

assertionsbashbash-scriptmockingtddtest-driven-developmenttestingtesting-frameworkunittestunittest-frameworkunittestingunittesting-library

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing
Activity
Custom properties

Stars

441 stars

Watchers

6 watching

Forks

59 forks
Report repository

Releases

Sponsor this project

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.