Configures Bats-core (Bash Automated Testing System) for testing CLI tools, shell scripts, and Unix programs - `.bats` test files with `@test` blocks, `run` to capture command exit + output, `[ "$status" -eq 0 ]` and `[ "$output" = ... ]` assertions, `setup`/`teardown` hooks, `load` for shared helpers, parallel execution via `--jobs N`, TAP-compliant output for CI integration. Use whenever the unit-under-test is a shell script, CLI binary, or anything invokable from Bash.
75
94%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
View guide
Passed
No findings from the security scan
Output-format flags and continuous-integration wiring for bats, split out of
the main skill spine. See SKILL.md for the core workflow.
# Default (pretty)
bats test/
# TAP (CI-friendly, parseable)
bats --tap test/
# JUnit XML (for CI dashboards via TAP-to-JUnit converters)
bats --formatter junit test/ > junit.xml
# Verbose (show stdout/stderr of every command)
bats --verbose-run test/jobs:
bats:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
with: { submodules: recursive }
- run: |
sudo apt-get install -y parallel
- run: bats --jobs 4 --formatter junit test/ > junit.xml
- uses: actions/upload-artifact@v4
if: always()
with: { name: bats-junit, path: junit.xml }submodules: recursive restores vendored bats-core / bats-support /
bats-assert when they are pinned as git submodules; GNU parallel is
required for --jobs.
For Docker-based CI, per bats: "Running Bats in Docker"
using the official bats/bats:latest image:
- run: docker run --rm -v "$PWD:/code" bats/bats:latest test/