2
0
Fork 0
mirror of https://github.com/bazel-contrib/bazel-lib synced 2024-12-04 14:02:23 +00:00
bazel-lib/docs/bats.md

45 lines
1.6 KiB
Markdown
Raw Normal View History

<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2024-02-26 23:05:14 +00:00
A test rule that invokes the [Bash Automated Testing System](https://github.com/bats-core/bats-core).
For example, a `bats_test` target containing a single .bat and basic configuration:
```starlark
bats_test(
name = "my_test",
size = "small",
srcs = [
"my_test.bats",
],
data = [
"data.bin",
],
env = {
"DATA_PATH": "$(location :data.bin)",
},
args = ["--timing"],
)
```
<a id="bats_test"></a>
## bats_test
<pre>
bats_test(<a href="#bats_test-name">name</a>, <a href="#bats_test-srcs">srcs</a>, <a href="#bats_test-data">data</a>, <a href="#bats_test-env">env</a>)
</pre>
**ATTRIBUTES**
| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="bats_test-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
| <a id="bats_test-srcs"></a>srcs | Test files | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="bats_test-data"></a>data | Runtime dependencies of the test. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | `[]` |
| <a id="bats_test-env"></a>env | Environment variables of the action.<br><br>Subject to [$(location)](https://bazel.build/reference/be/make-variables#predefined_label_variables) and ["Make variable"](https://bazel.build/reference/be/make-variables) substitution. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | `{}` |