Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Bats

$ bats Community Low Risk
bats-core · Code & DevOps · MIT · macos / linux

Bats (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.

FCRS-1.0 Score
77 /100
Good
Medium Confidence
Zero-Friction Install
brew install bats-core
CLI vs MCP Decision CLI Only

bats executes local .bats Bash test suites against local shells and binaries on disk; MCP is inapplicable.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
✓ Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 17 / 25

Deterministic non-interactive execution with --formatter tap, --formatter junit, --count, and --filter, though lacks native --json output.

  • --formatter tap emits plain TAP lines free of ANSI cursor control
  • Supports --formatter junit XML reports and --count dry inspection
Trust & Safety 21 / 25

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)
Setup & Portability 11 / 15

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
Utility & Efficiency 12 / 15

Standardized test harness for shell scripts and CLI regression tests with --jobs parallel support.

  • Parallel test execution via --jobs (parallel) and clean TAP output
Maintenance & Lineage 8 / 10

Actively maintained bats-core/bats-core community continuation under MIT license.

  • Maintained under bats-core/bats-core (MIT)
Docs & Verifiability 8 / 10

Well-organized Read the Docs manual covering formatters, assertions, and flags.

  • Official docs at bats-core.readthedocs.io

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

No authentication required; ephemeral test temporary directories are cleaned up automatically after each run.

Side Effects
Read-Only Local Write
Cost & Quotas

MIT open-source CLI; free to use.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# 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

Count test cases in a suite without running them
bats --count test/

Counts matching .bats test cases without executing test bodies.

Run shell tests with clean TAP output
bats --formatter tap test/

Runs tests non-interactively and emits plain TAP-13 test lines without ANSI formatting.

Controlled Writes & Previews

Run tests and write JUnit XML report
bats --formatter junit --output reports/ test/

Executes the test suite and writes structured JUnit XML files into reports/.

Strengths for Agents

  • + --formatter tap and --formatter junit produce clean, parser-friendly CI/agent output.
  • + --count and --filter <regex> enable fast selective test runs.
  • + Managed $BATS_TEST_TMPDIR isolates filesystem side effects between test cases.

Caveats & Pitfalls

  • ! No native --json formatter (only pretty, tap, tap13, and junit).
  • ! Requires Bash (macos / linux or WSL on Windows) and helper libraries (bats-assert) for rich assertions.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI