Closed
Description
I not infrequently find that I want to use both --grep
and --invert --grep
in the same test command: inclusively filter to a set of tests and exclude a subset of those too.
Just to put this out there for discussion, what if we:
- created
--invert-grep
or--grep-not
, which would be equivalent to the current--invert --grep
- optionally remove
--invert
for clarity in a semver major (we could see how much confusion it causes first) - until it's removed consider it an error to use
--invert
with the new--invert-grep
/--grep-not
- allow both
--grep
and--invert-grep
/--grep-not
in the same command, filtering to tests that satisfy both - optionally allow multiple
--grep
or--invert-grep
/--grep-not
, filtering to tests that satisfy all (this allows more flexible filtering than--grep "one thing.*another thing"
as it does not care about the order; ORing is not significantly more powerful than|
in a--grep
in contrast and makes almost no sense for--invert-grep
/--grep-not
*, so we don't really need it but if there's any use for it a--or-greps
option to change from ANDing to ORing would do -- I guess some of this explanation also applies even if multiple of the same type aren't allowed, just one of each type)
* You'd only exclude tests that contain the --invert-grep
/--grep-not
and do not also contain the --grep
, which is awfully broad... conceivably this could mean "use --grep
to make exceptions to the tests filtered out by --invert-grep
/--grep-not
", but this seems less likely to be a common use case. Something similar goes for ORing multiple --invert-grep
/--grep-not
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment