bats-core
brew install bats-core
v1.13.0
MIT
TAP-compliant testing framework for Bash scripts; write tests as annotated shell functions.
Why you might care
Essential for testing Bash scripts and CLI tools in CI/CD pipelines. Bats outputs TAP format, integrating with standard test harnesses and CI systems. Simpler and more maintainable than hand-rolled shell test assertions, with setup/teardown hooks and readable test syntax.
7.6k
30-day installs · #434
23.7k
90-day · #462
80.5k
365-day · #493
6.1k
★ GitHub stars · updated 5d ago
GitHub topics
bash
bats
junit
shell
tap
testing
testing-tools
xunit
Links
- https://github.com/bats-core/bats-core
- GitHub: bats-core/bats-core
- Brew formula source: Formula/b/bats-core.rb
Blurb generated by claude-haiku-4-5 on today.
Raw metadata
{
"aliases": [
"bats"
],
"alternatives": [
"shunit2",
"roundup",
"bash_unit"
],
"build_dependencies": [],
"categories": [
"testing",
"shell"
],
"caveats": null,
"conflicts_with": [],
"dependencies": [],
"deprecated": 0,
"deprecation_reason": null,
"desc": "Bash Automated Testing System",
"disable_reason": null,
"disabled": 0,
"enrichment_fetched_at": "2026-06-20T23:35:47+00:00",
"first_seen": "2026-06-20T23:34:18+00:00",
"full_name": "bats-core",
"github_default_branch": "master",
"github_last_commit_at": "2026-06-15T14:58:53Z",
"github_readme_excerpt": "[](https://github.com/bats-core/bats-core/releases/latest)\n[](https://www.npmjs.com/package/bats)\n[](https://github.com/bats-core/bats-core/blob/master/LICENSE.md)\n[](https://github.com/bats-core/bats-core/actions?query=workflow%3ATests)\n[](https://bats-core.readthedocs.io)\n\n[][gitter]\n\n\u003cdiv align=\"center\"\u003e\n\u003cpicture\u003e\n \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"docs/source/assets/dark_mode_cube.svg\"\u003e\n \u003cimg alt=\"\" src=\"docs/source/assets/light_mode_cube.svg\"\u003e\n\u003c/picture\u003e\n\u003c/div\u003e\n\n# Bats-core: Bash Automated Testing System\n\nBats is a [TAP](https://testanything.org/)-compliant testing framework for Bash\n3.2 or above. It provides a simple way to verify that the UNIX programs you\nwrite behave as expected.\n\nA Bats test file is a Bash script with special syntax for defining test cases.\nUnder the hood, each test case is just a function with a description.\n\n```bash\n#!/usr/bin/env bats\n\n@test \"addition using bc\" {\n result=\"$(echo 2+2 | bc)\"\n [ \"$result\" -eq 4 ]\n}\n\n@test \"addition using dc\" {\n result=\"$(echo 2 2+p | dc)\"\n [ \"$result\" -eq 4 ]\n}\n```\n\nBats is most useful when testing software written in Bash, but you can use it to\ntest any UNIX program.\n\nTest cases consist of standard shell commands. Bats makes use of Bash\u0027s\n`errexit` (`set -e`) option when running test cases. If every command in the\ntest case exits with a `0` status code (success), the test passes. In this way,\neach line is an assertion of truth.\n\n## Table of contents\n\n**NOTE** The documentation has moved to \u003chttps://bats-core.readthed",
"github_repo": "bats-core/bats-core",
"github_stars": 6122,
"github_topics": [
"bash",
"bats",
"junit",
"shell",
"tap",
"testing",
"testing-tools",
"xunit"
],
"homepage": "https://github.com/bats-core/bats-core",
"homepage_og_description": null,
"homepage_og_image": null,
"homepage_title": null,
"installs_30d": 7594,
"installs_365d": 80515,
"installs_90d": 23702,
"keg_only": 0,
"keg_only_reason": null,
"last_seen": "2026-06-20T23:34:18+00:00",
"license": "MIT",
"llm_generated_at": "2026-06-20T23:44:51+00:00",
"llm_model": "claude-haiku-4-5",
"name": "bats-core",
"oldnames": [],
"one_liner": "TAP-compliant testing framework for Bash scripts; write tests as annotated shell functions.",
"optional_dependencies": [],
"rank_30d": 434,
"rank_365d": 493,
"rank_90d": 462,
"raw_hash": "218dd9e0c7208e94",
"recommended_dependencies": [],
"revision": 0,
"ruby_source_path": "Formula/b/bats-core.rb",
"tap": "homebrew/core",
"test_dependencies": [],
"uses_from_macos": [],
"version_head": null,
"version_stable": "1.13.0",
"versioned_formulae": [],
"why_use_this": "Essential for testing Bash scripts and CLI tools in CI/CD pipelines. Bats outputs TAP format, integrating with standard test harnesses and CI systems. Simpler and more maintainable than hand-rolled shell test assertions, with setup/teardown hooks and readable test syntax."
}