Use whenever the code under test is a shell script, a CLI binary or anything run from Bash: argument parsing, flags, exit codes and output. Sets up Bats-core with @test blocks, run, status and output assertions, setup/teardown, shared helpers and TAP output for CI.
89%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
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/