-
-
Notifications
You must be signed in to change notification settings - Fork 906
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
Public Filter
/FilterFlags
replacement
#1145
Comments
I was playing around with this a bit and build a (maybe overcomplicated) POC. Changespublic func it(
_ description: String,
tags: [Tag: Bool] = [:],
file: FileString = #file,
line: UInt = #line,
closure: @escaping () throws -> Void
) {
World.sharedWorld.it(description, tags: tags, file: file, line: line, closure: closure)
} This re-adds a dictionary property to the The public enum Tag {
case string(String)
} Again, my preferred name would be This enum conforms to When it comes to filtering for the tags I created a convenience extension for Naming TBD. Took the Rspec naming here. public extension QCKConfiguration {
func filterRunExclude(_ tag: Tag, _ excludedValue: Bool) {
exclude { example in
// ...
}
}
} In order to pass the public let tags: [Tag: Bool] UsageThe advantage of the extension Tag {
static var isFlaky: Self { "isFlaky" }
} As the enum just uses a With the extension Tag {
@LazyTag
static var isFlaky
} In order to use the tag now on the test itself, you can use the dot syntax: it("...", tags: [.isFlaky: true]) { When it comes to filtering for the tag now, the new method on the class TagConfiguration: QuickConfiguration {
override class func configure(_ configuration: QCKConfiguration) {
configuration.filterRunExclude(.isFlaky, isRunningOnCi)
configuration.filterRunExclude(.foo, true)
configuration.filterRunExclude(.bar, false)
}
} Maybe the enum is overengineered. As an alternative plain string handling with constants would work as well. The enum would rule out string handling and potential errors in this case though. Please consider that this is a POC Open questions:
Feedback welcome 🙂 |
What did you do?
I am currently trying to update to version v5.0.0 as it contains a fix when using
Xcode
13.3
.However, version
5.0.0
has a breaking change I currently (heavily) rely on. Currently, I use theFilter.pending
for following use-cases: all at runtimearm
because of throwAssertion not working with Rosetta Nimble#961)I do understand why they were removed from public API and that they shouldn't have been there in first place.
Though is there a plan for a replacement API or a new feature for this kind of use-cases?
Right now I can work around this and it doesn't block me from updating but it would be nice to have a feature like this build in Quick.
This issue is very similar to #800 but as it was closed recently and wasn't very active and I don't comply with the API and approach used in the original post I decided to open a new one. The proposed API there seems a bit fragile and not Swift-like to work with 'tags' in the test name itself.
As proposed in #800, exclusion-filters as in Rspec could be interesting. As I understand this feature is basically there internally but not exposed to the public.
I would be happy to contribute if possible and once we settled on a good API design.
Environment
List the software versions you're using:
The text was updated successfully, but these errors were encountered: