-
Notifications
You must be signed in to change notification settings - Fork 627
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@RequiresTag does not work as expected #3531
Comments
Related work was done in #3189, could be used as inspiration for how to test and fix this. |
… are present in the runtime tags, but some specs are annotated with @RequiresTag() Ref kotest#3531
… are present in the runtime tags, but some specs are annotated with @RequiresTag() Ref kotest#3531
This affects Kotest at least since v5.0.0, so the defect has been around a long while.. Perhaps it warrants a bit of a discussion on the semantic difference between IMO it would make sense if E.g. a test annotated with This would definitely be breaking behaviour though, since currently negated expressions will satisfy If we decide to just fix |
… are present in the runtime tags, but some specs are annotated with @RequiresTag() Ref kotest#3531
… are present in the runtime tags, but some specs are annotated with @RequiresTag() (#3532) * test(RequiresTagInterceptor): Add tests for interceptor, with failing test for !3531 * fix(RequiresTagInterceptor): Add fix to handle scenario where no tags are present in the runtime tags, but some specs are annotated with @RequiresTag() Ref #3531 * fixup! test(RequiresTagInterceptor): Add tests for interceptor, with failing test for !3531 --------- Co-authored-by: Emil Kantis <emil.kantis@protonmail.com>
Which version of Kotest are you using
5.6
Reopening #3274 (marked as bug but closed due to inactivity).
Expected behavior:
Adding a
RequiresTag()
annotation to a spec class prevents that class from being run unless the tag is in the list of active tags in the argument (i.e. not negated, or no tags specified)Observed behavior:
Adding a
RequiresTag()
annotation to a spec class has no effect unless some other tag is specified (i.e. TagExpression is not null)concrete example:
I have a tag
object EndToEnd: Tag()
that I don't want to run by default when./gradlew myproject:test
is run. I've added@RequiresTag("EndToEnd")
to my e2e spec classes.workaround: I could negate it with
./gradlew myproject:test -Dkotest.tags="!EndToEnd"
however that seems to defeat the purpose ofRequiresTag()
annotationThe text was updated successfully, but these errors were encountered: