Skip to content

[nextest-filtering] add group() filterset predicate for CLI filters#3273

Merged
sunshowers merged 1 commit into
mainfrom
group-predicate
Apr 14, 2026
Merged

[nextest-filtering] add group() filterset predicate for CLI filters#3273
sunshowers merged 1 commit into
mainfrom
group-predicate

Conversation

@sunshowers

Copy link
Copy Markdown
Member

Add a new filterset predicate, group(), to list tests by test group.

@codecov

codecov Bot commented Apr 13, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.77072% with 58 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.51%. Comparing base (1adb8e0) to head (4034150).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
nextest-runner/src/list/test_list.rs 77.60% 28 Missing ⚠️
cargo-nextest/src/dispatch/utility/debug.rs 65.00% 14 Missing ⚠️
...st-runner/src/config/overrides/group_membership.rs 96.57% 5 Missing ⚠️
cargo-nextest/src/errors.rs 0.00% 4 Missing ⚠️
nextest-filtering/src/expression.rs 95.31% 3 Missing ⚠️
cargo-nextest/src/dispatch/core/run.rs 85.71% 2 Missing ⚠️
cargo-nextest/src/dispatch/core/list.rs 92.85% 1 Missing ⚠️
nextest-runner/src/config/elements/test_group.rs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3273      +/-   ##
==========================================
+ Coverage   85.46%   85.51%   +0.04%     
==========================================
  Files         159      160       +1     
  Lines       47300    47814     +514     
==========================================
+ Hits        40424    40887     +463     
- Misses       6876     6927      +51     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR extends nextest’s filterset language with a group() predicate for CLI -E filters, enabling users to select tests by configured test group. It also wires group validation and evaluation end-to-end across cargo-nextest, nextest-runner, and nextest-filtering, including test coverage and a debug utility for parsing filtersets.

Changes:

  • Add group() as a runtime-only predicate in nextest-filtering, including compile-time validation via KnownGroups and evaluation via GroupLookup.
  • Precompute per-test group membership in nextest-runner (from overrides that set test-group) and pass that lookup into CLI expression evaluation.
  • Add cargo nextest debug parse-filterset plus new/updated integration snapshots for banned predicates.

Reviewed changes

Copilot reviewed 31 out of 31 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
nextest-runner/src/test_filter.rs Adds group-aware expression matching and has_group_predicates() gating.
nextest-runner/src/runner/executor.rs Switches global group env var to shared metadata constant.
nextest-runner/src/list/test_list.rs Precomputes group membership when needed and passes GroupLookup into filtering; adds tests.
nextest-runner/src/config/scripts/imp.rs Updates filterset parsing calls to pass KnownGroups.
nextest-runner/src/config/overrides/mod.rs Exposes new group_membership module.
nextest-runner/src/config/overrides/imp.rs Introduces OverrideFilter kind; centralizes override applicability logic; updates banned-predicate labels.
nextest-runner/src/config/overrides/group_membership.rs New group membership precomputation + GroupLookup impl + unit tests.
nextest-runner/src/config/elements/test_group.rs Uses shared GLOBAL_TEST_GROUP constant for parsing/deserialization.
nextest-runner/src/config/core/imp.rs Adds known_groups() and precompute_group_memberships() on profiles.
nextest-metadata/src/test_list.rs Defines and exports GLOBAL_TEST_GROUP.
nextest-filtering/tests/match.rs Expands parsing calls to include KnownGroups; adds extensive group() tests and banned-predicate tests.
nextest-filtering/src/proptest_helpers.rs Adds Group leaf to proptest generation.
nextest-filtering/src/parsing.rs Adds group() leaf parsing and display; marks it runtime-only.
nextest-filtering/src/lib.rs Re-exports GroupLookup and KnownGroups.
nextest-filtering/src/expression.rs Implements group() evaluation, GroupLookup, KnownGroups, and OverrideFilter kind.
nextest-filtering/src/errors.rs Adds NoGroupMatch; refines banned predicate reasons/messages.
nextest-filtering/src/compile.rs Validates group() against known groups; bans predicates by filterset kind; early-return on banned predicates.
nextest-filtering/examples/parser.rs Updates example to pass KnownGroups.
integration-tests/tests/integration/snapshots/integration__banned_test_in_archive_filter.snap New snapshot for banned test() in archive filtersets.
integration-tests/tests/integration/snapshots/integration__banned_group_in_override_filter.snap New snapshot for banned group() in override filtersets.
integration-tests/tests/integration/snapshots/integration__banned_group_in_default_filter.snap New snapshot for banned group() in default-filter expressions.
integration-tests/tests/integration/snapshots/integration__banned_group_in_archive_filter.snap New snapshot for banned group() in archive filtersets.
integration-tests/tests/integration/snapshots/integration__banned_default_in_default_filter.snap New snapshot for banned default() in default-filter expressions.
integration-tests/tests/integration/snapshots/integration__archive_unsupported_build_filter.snap Snapshot updated with assertion line metadata.
integration-tests/tests/integration/main.rs Adds integration test covering banned predicates via debug parse-filterset.
cargo-nextest/src/errors.rs Adds DebugParseFiltersetError expected error variant and exit code mapping.
cargo-nextest/src/dispatch/utility/debug.rs Adds debug parse-filterset subcommand with optional cargo-metadata input.
cargo-nextest/src/dispatch/helpers.rs Extends build_filtersets to accept KnownGroups.
cargo-nextest/src/dispatch/core/run.rs Supplies known_groups when building CLI test filtersets.
cargo-nextest/src/dispatch/core/list.rs Supplies known_groups when building CLI test filtersets.
cargo-nextest/src/dispatch/core/archive.rs Supplies KnownGroups::Unavailable for archive filtersets.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread nextest-runner/src/test_filter.rs Outdated
Comment thread nextest-runner/src/config/overrides/group_membership.rs
Comment thread cargo-nextest/src/dispatch/utility/debug.rs
@trunk-io

trunk-io Bot commented Apr 13, 2026

Copy link
Copy Markdown

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

Add a new filterset predicate, `group()`, to list tests by test group.
@sunshowers sunshowers merged commit a63bcaf into main Apr 14, 2026
26 checks passed
@sunshowers sunshowers deleted the group-predicate branch April 14, 2026 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants