Has anything changed around the Tags / ProjectConf...
# kotest
r
Has anything changed around the Tags / ProjectConfig discovery? It looks like I’ve got a regression, where either the config isn’t being picked up or the tag isn’t being applied, and a test I was expecting to be skipped is being run. Haven’t explored very far yet; not even sure whether it’s a 4.0, 4.1 or 4.2 that it changed in.
s
Which version are you using rob?
Certainly some things changed in 4.2 but internally, perhaps a regression
r
Just upgraded to 4.2.0.RC3 - I really haven’t done any due diligence around diagnosing it myself yet, just spotted it and wondered if I’d missed something in the changelog. I’ll look properly this evening.
s
4.2.0 has just been released FYI but it's almost exactly the same as 4.2.0.RC3
What version did you upgrade from
r
4.1.3, but I wouldn’t like to swear it was working there… pretty certain it was working in 4.0.6. I’ll try reverting later and work out exactly which version it regressed in, and see if it’s something to do with which dependencies I’ve brought in - I got a bit confused with the jar name changes.
s
Ok, when you do play around later, let me know how you are tagging things, and what expression you are passing in at runtime. I will investgiate too.
r
It is a regression in 4.2.0 - works in 4.1.3. I think it’s that
io.kotest.core.SpecFunctionConfiguration.tags()
is never overridden so always returns
emptySet()
when called here:
Copy code
package io.kotest.core.internal
fun TestCase.isActive(): Boolean {
  val enabledInTags = configuration.resolvedTags().parse().isActive(config.tags + spec.resolvedTags())
}
s
You don't need to override tags() in SpecFunctionConfiguration, that's if you want to set tags at the spec level
Tags can also come from the config object
r
Oh, I see - I’m looking at the wrong half of the union 😳
s
There's definitely an error in there though, which would affect the plugin, not what you're doing, so you found something at least 😂
Where are you setting the tags to apply?
r
Copy code
class MainWindowTest : StringSpec({

  tags(UI)
  ...
})
s
And the tags that you want to enable in the run
r
Copy code
@Suppress("unused") // read by reflection
object ProjectConfig : AbstractProjectConfig() {
  override fun extensions() = listOf(UITagExtension)
}
Copy code
object UITagExtension : TagExtension {

  override fun tags(): Tags =
    if (shouldRunUITests()) Tags.Empty else Tags.exclude(UI)
}
s
ok thanks, I will add some test cases for this exact combo
It'll have to be tonight, CST time.
4.2.0 was a big release as kotlin 1.4.0 broke some backwards compatibility, so I expect to do a 4.2.1 straight away with some mop-up tickets
r
Cool, thanks!
s
Thanks for the bug report
r
Would you like me to do a proper one on GitHub?
s
Yeah that would be good. Include the 3 snippets you put here if you don't mind
r
Of course
s
cheers bud