# 使用 Homebrew, apk, MacPorts, pacman, apt, dnf, Nix, zypper 安装 bats-core

查看 bats-core 的安装路径、可执行文件、元数据以及面向 AI 代理工作流的安全说明。

## 安装

```sh
sudo av install brew:bats-core
```

其他安装命令:

### macOS

- Homebrew (100%):

```sh
brew install bats-core
```

  证据: local Homebrew formula metadata

- MacPorts (94%):

```sh
sudo port install bats-core
```

  证据: MacPorts ports tree: sysutils/bats-core/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1

### Linux

- apk (92%):

```sh
sudo apk add bats-core
```

  证据: Alpine Linux edge package indexes: bats-core from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz

- pacman (92%):

```sh
sudo pacman -S bats
```

  证据: Arch Linux sync databases: bats from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz

- Debian apt (92%):

```sh
sudo apt install bats
```

  证据: Debian stable package indexes: bats from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz

- dnf (92%):

```sh
sudo dnf install bats
```

  证据: Fedora Rawhide package metadata: bats from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst

- Nix (92%):

```sh
nix profile install nixpkgs#bats
```

  证据: nixpkgs package indexes: pkgs/by-name/ba/bats/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1

- zypper (92%):

```sh
sudo zypper install bats
```

  证据: openSUSE Tumbleweed package metadata: bats from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst

## 软件包事实

- **软件包键:** brew:bats-core
- **软件包管理器:** Homebrew
- **版本:** 1.14.0
- **来源摘要:** Bash Automated Testing System
- **主页:** <https://github.com/bats-core/bats-core>
- **仓库:** <https://github.com/bats-core/bats-core>
- **最后更新:** 2026-07-22T08:40:21Z
- **已生成:** 2026-08-03T19:37:03+00:00

## 可执行文件

- bats (别名)

## 安装行为

- Bottle: 不可用

## 版本和新鲜度

- 页面生成时间: 2026-08-03
- 管理器版本: 1.14.0
## 项目历史与用法

bats-core is the community-maintained continuation of Bats, the Bash Automated Testing System: a TAP-compliant testing framework where test files are Bash scripts and each test case runs normal shell commands.

### 项目历史

The original Bats project dates to Sam Stephenson's 2011-2016 copyright era. The current README says bats-core was forked from the original Bats repository on Tuesday, September 19, 2017 at commit 0360811 after development had stalled and write access to the original repository could not be obtained.

bats-core released Bats 1.0.0 on June 8, 2018. That release emphasized compatibility with 0.4.0 while adding Bash compatibility work, Docker support, better Windows and macOS stability, TAP fixes, and major performance improvements.

The original Bats repository was archived read-only by its owner as of April 29, 2021, and the bats-core README identifies bats-core as the community-maintained Bats project.

### 采用历史

Bats-core is widely packaged as the practical shell-testing tool for Unix projects. The input metadata lists apk, Homebrew, Debian, Fedora, MacPorts, Nix, Arch, Ubuntu, and zypper packages, while the upstream README points users to GitHub issues, tested pull requests, examples of projects using Bats, and Read the Docs documentation.

The repository page showed about 6.1k stars, roughly 2,004 commits, and 24 releases at enrichment time, with v1.13.0 shown as the latest release on November 7, 2025.

### 使用方式

A Bats test file is a Bash script with special syntax for test cases. Under the hood, each test is a function with a description, and ordinary shell commands become assertions through exit status and Bash errexit behavior.

Bats is most useful for testing Bash software, but the README explicitly notes it can test any Unix program. That makes it popular for CLI packages, install scripts, dotfiles, shell libraries, and smoke tests around command-line behavior.

### 为什么软件包爱好者会关心

bats-core is one of the package-nerd standards for testing shell-facing software because it sits exactly where many package bugs happen: command names, exit statuses, stdout/stderr, file effects, and portable shell behavior.

Its history also matters culturally. It shows a successful community-maintained fork preserving a small but widely depended-on developer tool when the original repository stalled, while keeping compatibility with existing Bats tests.

Because it emits TAP and uses shell syntax, bats-core fits neatly into old and new CI systems, distro packaging tests, and language-agnostic build pipelines without demanding a heavier test framework.

### 时间线

- 2011-2016: Original Bats copyright period credited to Sam Stephenson.
- 2017: bats-core fork created from original Bats on September 19.
- 2018: Bats 1.0.0 released on June 8 with compatibility, Docker, stability, and performance improvements.
- 2021: Original Bats repository archived read-only on April 29.
- 2025: Repository page lists v1.13.0 as latest release on November 7.

### Related projects

- sstephenson/bats is the original Bats repository.
- The bats-core ecosystem includes helper libraries such as bats-support, bats-assert, bats-file, and bats-detik.
- TAP is the output protocol family that makes Bats results easy to consume in broader test tooling.

### 来源

- <https://github.com/bats-core/bats-core>
- <https://github.com/bats-core/bats-core/releases/tag/v1.0.0>
- <https://github.com/bats-core/bats-core/releases/tag/v1.11.1>
- <https://github.com/sstephenson/bats/issues/236>
- source_facts.package-manager


## 安全说明

narrow executable package without higher-risk signals.

- **Geiger 风险:** 绿色 / 低
- narrow executable package without higher-risk signals

## 其他软件包管理器记录

- apk - bats-core - 1.13.0-r0: normalized package name match | Alpine Linux edge package indexes: bats-core from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Bash Automated Testing System | https://github.com/bats-core/bats-core
- apk - bats-core-doc - 1.13.0-r0: normalized package name match | Alpine Linux edge package indexes: bats-core-doc from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Bash Automated Testing System (documentation) | https://github.com/bats-core/bats-core
- pacman - bats - 1.14.0-1: normalized package name match | Arch Linux sync databases: bats from https://geo.mirror.pkgbuild.com/extra/os/x86_64/extra.db.tar.gz | Bash Automated Testing System | https://github.com/bats-core/bats-core
- MacPorts - bats-core: normalized package name match | MacPorts ports tree: sysutils/bats-core/Portfile from https://api.github.com/repos/macports/macports-ports/git/trees/master?recursive=1
- Debian apt - bats - 1.11.1-1: installed executable or alias match | Debian stable package indexes: bats from https://deb.debian.org/debian/dists/stable/main/binary-amd64/Packages.xz | bash automated testing system | https://github.com/bats-core/bats-core
- Nix - bats: installed executable or alias match | nixpkgs package indexes: pkgs/by-name/ba/bats/package.nix from https://api.github.com/repos/NixOS/nixpkgs/git/trees/master?recursive=1
- Ubuntu apt - bats - 1.10.0-1: installed executable or alias match | Ubuntu 24.04 LTS package indexes: bats from https://archive.ubuntu.com/ubuntu/dists/noble/universe/binary-amd64/Packages.gz | bash automated testing system | https://github.com/bats-core/bats-core
- apk - bats - 1.13.0-r1: installed executable or alias match | Alpine Linux edge package indexes: bats from https://dl-cdn.alpinelinux.org/alpine/edge/main/x86_64/APKINDEX.tar.gz | Meta package for Bats | https://bats-core.readthedocs.io/
- dnf - bats - 1.14.0-1.fc45: installed executable or alias match | Fedora Rawhide package metadata: bats from https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/Everything/x86_64/os/repodata/07190dc5ae9f35ae73866675fed6d95fe6e8d9fe22c9d7cdf85862cb2ed24a4c-primary.xml.zst | Bash Automated Testing System | https://github.com/bats-core/bats-core
- zypper - bats - 1.13.0-1.2: installed executable or alias match | openSUSE Tumbleweed package metadata: bats from https://download.opensuse.org/tumbleweed/repo/oss/repodata/50b07339cb64c8ed4091bdbabddadc1ff5737b090e478818a195b40d8a3292861a879139b4a3987c31109699fde9fbf4a716367ddf4eef77da75f96e3193d6ed-primary.xml.zst | Bash Automated Testing System | https://github.com/bats-core/bats-core/


## Combined YAML source

View the package source record on GitHub. [combined/bats-core.yml](https://github.com/mxcl/pkgdb/blob/main/combined/bats-core.yml)


## 来源

- pkg.so package database
- Geiger risk classifier
- curated package history
- pkgdb category and tag curation
- external package-manager database matches
- cross-ecosystem install command graph
