Bats
$ bats Community Low RiskBats (bats / bats-core) is a TAP-compliant testing framework for Bash scripts and CLI tools. It supports machine-friendly --formatter tap and --formatter junit XML reports, parallel execution (--jobs), and --filter test selection without interactive prompts.
brew install bats-core bats executes local .bats Bash test suites against local shells and binaries on disk; MCP is inapplicable.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Deterministic non-interactive execution with --formatter tap, --formatter junit, --count, and --filter, though lacks native --json output.
--formatter tapemits plain TAP lines free of ANSI cursor control- Supports
--formatter junitXML reports and--countdry inspection
Provides $BATS_TEST_TMPDIR isolation per test and automatic cleanup, though .bats tests run arbitrary local Bash commands.
- Automatic per-test temporary directory lifecycle (
$BATS_TEST_TMPDIR)
Pure Bash tool installable via Homebrew, npm, and Linux distros for macOS and Linux (requires Bash 3.2+).
- POSIX/Bash-only (
macos,linux), requiring WSL on Windows
Standardized test harness for shell scripts and CLI regression tests with --jobs parallel support.
- Parallel test execution via
--jobs(parallel) and clean TAP output
Actively maintained bats-core/bats-core community continuation under MIT license.
- Maintained under
bats-core/bats-core(MIT)
Well-organized Read the Docs manual covering formatters, assertions, and flags.
- Official docs at bats-core.readthedocs.io
Security, Auth & Guardrails
No authentication required; ephemeral test temporary directories are cleaned up automatically after each run.
MIT open-source CLI; free to use.
# Bats (bats) Agent Rules - Pass `--formatter tap` (or `--tap`) for clean, ANSI-free output in agent logs. - Use `--count` or `--filter <regex>` before running slow integration suites.
Agent-Ready Command Recipes
Safe Read-Only Queries
bats --count test/
Counts matching .bats test cases without executing test bodies.
bats --formatter tap test/
Runs tests non-interactively and emits plain TAP-13 test lines without ANSI formatting.
Controlled Writes & Previews
bats --formatter junit --output reports/ test/
Executes the test suite and writes structured JUnit XML files into reports/.
Strengths for Agents
- +
--formatter tapand--formatter junitproduce clean, parser-friendly CI/agent output. - +
--countand--filter <regex>enable fast selective test runs. - + Managed
$BATS_TEST_TMPDIRisolates filesystem side effects between test cases.
Caveats & Pitfalls
- ! No native
--jsonformatter (onlypretty,tap,tap13, andjunit). - ! Requires Bash (
macos/linuxor WSL on Windows) and helper libraries (bats-assert) for rich assertions.