| name | bats |
| description | Use this skill when the user wants to write or run Bash shell tests — TAP-compliant test suites, CI integration, mocking, and parallel test execution. |
bats Plugin
Bash Automated Testing System. Write unit and integration tests for shell scripts with readable syntax, TAP output, and first-class CI support.
Installation
npm install -g bats
brew install bats-core
Basic Usage
bats test/example.bats
bats test/
bats --count test/
Common Patterns
bats --filter "login" test/
bats --jobs 4 test/
bats --tap test/
bats --formatter junit test/ > report.xml
Writing Tests
@test "addition works" {
result=$(echo $((2 + 2)))
[ "$result" -eq 4 ]
}
Usage Examples
- "Run all Bash tests in the test/ directory"
- "Filter bats tests matching 'deploy'"
- "Output bats results in TAP format for CI"
SuperCLI
sc bats test run test/example.bats
sc bats _ _ --filter "auth" test/
sc plugins learn bats