Skip to main content
Version: 2.7.x

bats

A test rule that invokes the Bash Automated Testing System.

For example, a bats_test target containing a single .bat and basic configuration:

bats_test(
name = "my_test",
size = "small",
srcs = [
"my_test.bats",
],
data = [
"data.bin",
],
env = {
"DATA_PATH": "$(location :data.bin)",
},
args = ["--timing"],
)

Rules

bats_test

Example usage (generated):

load("@aspect_bazel_lib//lib:bats.bzl", "bats_test")

bats_test(
# A unique name for this target.
name = "",
)

name

Required name.

A unique name for this target.

data

Optional list of labels. Default: []

Runtime dependencies of the test.

env

Optional dictionary: String → String. Default: {}

Environment variables of the action.

Subject to $(location) and "Make variable" substitution.

srcs

Optional list of labels. Default: []

Test files