https://kotlinlang.org logo
Title
r

Rob Elliot

08/20/2020, 9:41 AM
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

sam

08/20/2020, 10:01 AM
Which version are you using rob?
Certainly some things changed in 4.2 but internally, perhaps a regression
r

Rob Elliot

08/20/2020, 10:25 AM
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

sam

08/20/2020, 10:26 AM
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

Rob Elliot

08/20/2020, 10:32 AM
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

sam

08/20/2020, 10:36 AM
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

Rob Elliot

08/20/2020, 7:37 PM
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:
package io.kotest.core.internal
fun TestCase.isActive(): Boolean {
  val enabledInTags = configuration.resolvedTags().parse().isActive(config.tags + spec.resolvedTags())
}
s

sam

08/20/2020, 7:40 PM
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

Rob Elliot

08/20/2020, 7:40 PM
Oh, I see - I’m looking at the wrong half of the union 😳
s

sam

08/20/2020, 7:42 PM
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

Rob Elliot

08/20/2020, 7:45 PM
class MainWindowTest : StringSpec({

  tags(UI)
  ...
})
s

sam

08/20/2020, 7:46 PM
And the tags that you want to enable in the run
r

Rob Elliot

08/20/2020, 7:47 PM
@Suppress("unused") // read by reflection
object ProjectConfig : AbstractProjectConfig() {
  override fun extensions() = listOf(UITagExtension)
}
object UITagExtension : TagExtension {

  override fun tags(): Tags =
    if (shouldRunUITests()) Tags.Empty else Tags.exclude(UI)
}
s

sam

08/20/2020, 7:47 PM
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

Rob Elliot

08/20/2020, 8:09 PM
Cool, thanks!
s

sam

08/20/2020, 8:12 PM
Thanks for the bug report
r

Rob Elliot

08/20/2020, 8:16 PM
Would you like me to do a proper one on GitHub?
s

sam

08/20/2020, 8:16 PM
Yeah that would be good. Include the 3 snippets you put here if you don't mind
r

Rob Elliot

08/20/2020, 8:16 PM
Of course
s

sam

08/20/2020, 8:17 PM
cheers bud