Skip to main content
Version: 5.9.x

Testing

The test task runs bazel test.

The simplest configuration:

.aspect/workflows/config.yaml
tasks:
- test:

This will run all tests in the workspace, e.g. bazel test //.... You can select specific targets by adding a targets attribute, which is a list of patterns, e.g.

.aspect/workflows/config.yaml
tasks:
- test:
targets:
# All targets in project A
- //projectA/...
# But excluding this subpackage
- -//projectA/excluded:all

Setting flags for the test task is the same as for build, see Specifying flags.

Enabling coverage

Workflows doesn't run bazel coverage due to some historical bugs with invalidating the analysis cache. Instead, we run bazel test with some flags that have equivalent behavior.

Enabling coverage just requires adding a line to the configuration:

.aspect/workflows/config.yaml
tasks:
- test:
coverage:

API Doc

The exhaustive list of attributes for the test task are found at test.