Add filterset DSL for test selection#663
Conversation
Replaces `-t`/`--tag` and `-m`/`--match` with a single `-E`/`--filter` expression language inspired by nextest's filtersets: predicates `test(<matcher>)` and `tag(<matcher>)` combined with `&`, `|`, `not`, `-`, and parentheses, with `=exact`, `~substring`, `/regex/`, and `#glob` matcher modes. Closes #546.
Merging this PR will not alter performance
|
|
hey @MatthewMckee4 Now that the filterset DSL (-E/--filter) has been merged in #663, issue #549 seems to be covered without a dedicated skip() karva test -E 'not test(~slow_)' I can see the issue #549 was marked as resolved, or would it be worth adding a dedicated skip(pattern) shorthand predicate to the DSL (e.g. -E 'skip(~slow_)' right? this will a better choice but your call !! Thank you |
Summary
Closes #546.
Replaces
-t/--tagand-m/--matchwith one flag,-E/--filter, that takes an expression language like nextest's filtersets.Two predicates:
test(...)against the qualified test name,tag(...)against custom tags. Four matcher kinds —=exact,~substring,/regex/,#glob— withtest()defaulting to substring andtag()defaulting to exact. Operators are&,|,not, and-(and-not), with parens for grouping. Keyword spellingsand/or/notalso work. Multiple-Eflags OR together like-t/-mused to.Old → new:
-t slow→-E 'tag(slow)'-m auth→-E 'test(/auth/)'-t slow -m auth→-E 'tag(slow) & test(/auth/)'-t '(slow or fast) and not flaky'→-E '(tag(slow) | tag(fast)) - tag(flaky)'The full table is in
docs/usage/filtering.md.This is a breaking change —
-tand-mare gone, not deprecated, per the issue thread.The parser is in
crates/karva_metadata/src/filter.rs, extending the old tag expression parser. Only new dep isglobset. Filter application inpackage_runner::should_skip_variantis now one call instead of two. CLI parse errors get wrapped so you see which flag failed before the detailed reason.All filter integration tests moved into
crates/karva/tests/it/filterset.rs;name_filter.rsis deleted and the filter tests inextensions/tags/custom.rsandparametrize.rsmoved over. Tag mechanics tests stay where they were.Test plan
just testpasses anduvx prek run -ais clean.