Skip to content

Commit aff7b65

Browse files
committed
[site] add information about filtersets + default sets
1 parent afcba61 commit aff7b65

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

site/src/docs/filtersets/index.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Nextest supports a domain-specific language (DSL) for choosing sets of tests called **filtersets** (formerly **filter expressions**). The DSL is inspired by, and is similar to, [Bazel query](https://bazel.build/docs/query-how-to) and [Mercurial revsets](https://www.mercurial-scm.org/repo/hg/help/revsets).
44

5+
Filtersets are specified on the command line with `-E`, or `--filterset` <!-- md:version 0.9.76 -->. (In prior versions of nextest, use `--filter-expr`.)
6+
57
## Example: Running all tests in a crate and its dependencies
68

79
To run all tests in `my-crate` and its dependencies, run:
@@ -26,6 +28,16 @@ This is equivalent to:
2628
cargo nextest run -E 'test(my_test) + package(my-crate)'
2729
```
2830

31+
!!! warning "If both filtersets and substring filters are specified..."
32+
33+
If you pass in both a filterset and a substring-based filter, tests must match **both** of them. In other words, the union of all filtersets is intersected with the union of substring filters.
34+
35+
For example, the command:
36+
37+
cargo nextest run -E 'package(foo)' -- test_bar test_baz
38+
39+
will run all tests that meet **both** conditions: in package `foo`, and match either `test_bar` or `test_baz`.
40+
2941
### Examples of filtersets
3042

3143
`package(serde) and test(deserialize)`
@@ -37,15 +49,17 @@ cargo nextest run -E 'test(my_test) + package(my-crate)'
3749
`not (test(/parse[0-9]*/) | test(run))`
3850
: Matches every test not matching the regex `parse[0-9]*` or the substring `run`.
3951

40-
!!! warning "If both filtersets and substring filters are specified..."
52+
### Filtersets with the default set
4153

42-
If you pass in both a filterset and a substring-based filter, tests must match **both** of them. In other words, the union of all filtersets is intersected with the union of substring filters.
54+
<!-- md:version 0.9.76 -->
4355

44-
For example, the command:
56+
If [a default set](../running.md#running-a-subset-of-tests-by-default) of tests is configured, then filtersets on the command line are intersected with the default set.
4557

46-
cargo nextest run -E 'package(foo)' -- test_bar test_baz
58+
To match against all tests, not just the default set, pass in `--bound=all`.
4759

48-
will run all tests that meet **both** conditions: in package `foo`, and match either `test_bar` or `test_baz`.
60+
Filtersets specified in configuration (for example, in [per-test
61+
settings](../configuration/per-test-overrides.md), or `default-set` itself) do not take into account
62+
the default set.
4963

5064
## DSL reference
5165

0 commit comments

Comments
 (0)