Description
When a section/generator selection (-c/--section, -g/--generator-index,
or -p/--path-filter) is in effect, the console and compact reporters now
print the active path filters on a Path filters: line, right below the
existing Filters: line and using the same highlight colour:
Filters: "foo"
Path filters: c:"A" g:0Section filters are serialized as c:"<filter>" and generator filters as
g:<filter>, mirroring the -p/--path-filter syntax. The line is only
printed when path filters are present, so default runs are unaffected.
The motivation: Catch2 currently gives no feedback about what was actually selected, which makes it hard to tell what went wrong when a filter combination ends up running no assertions, e.g.:
Filters: "Scenario: Create and train model on entire dataset"
Randomness seeded to: 3221299838
===============================================================================
test cases: 1 | 1 passed
assertions: - none -Implementation notes:
- Added a
serializePathFilters()helper incatch_reporter_helpers, alongside the existingserializeFilters(). - Wired it into
ConsoleReporter::testRunStartingandCompactReporter::testRunStarting. - Documented the printout in
docs/filtering-execution-path.md. - Tests: a unit test for
serializePathFilters(format + ordering) and two CTest integration tests verifying both reporters emit the line. Baselines were updated to account for the new self-test case.
Structured reporters (XML/JSON/JUnit/TAP/SonarQube) are intentionally left out of scope; this could be a follow-up if desired.
GitHub Issues
Implements the request in #3099.
Activity
4Nice usability improvement. Printing the active section/generator path filters makes it much easier to understand why a filtered run produced a particular result, especially when no assertions execute. I also like that the formatting logic is centralized in serializePathFilters and backed by both unit and integration tests. The documentation and baseline updates look comprehensive as well. LGTM.
Rebased onto latest devel and resolved the conflicts. Could you approve the CI workflows and take a look when you get a chance? Thanks!
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 91.21%. Comparing base (
0809213) to head (3b96584).Additional details and impacted files
:rocket: New features to boost your workflow: