Kotest: Some tags not being recognised in 4.2.0

Created on 20 Aug 2020  路  2Comments  路  Source: kotest/kotest

Upgraded to 4.2.0. The following Spec now runs despite being tagged not to run:

import io.kotest.assertions.fail
import io.kotest.core.Tag
import io.kotest.core.Tags
import io.kotest.core.config.AbstractProjectConfig
import io.kotest.core.extensions.TagExtension
import io.kotest.core.spec.style.StringSpec

object Exclude : Tag()

object ExcludeTagExtension : TagExtension {
  override fun tags(): Tags = Tags.exclude(Exclude)
}

@Suppress("unused") // read by reflection
object ProjectConfig : AbstractProjectConfig() {
  override fun extensions() = listOf(ExcludeTagExtension)
}

class ExcludedSpec : StringSpec({

  tags(Exclude)

  "should not run" {
    fail("Shouldn't get here")
  }
})
bug framework

All 2 comments

I've fixed this in master so will be in 4.2.1
I've also updated the plugin so that

object ProjectConfig : AbstractProjectConfig() {
  override fun extensions() = listOf(ExcludeTagExtension)
}

will be marked as used so you won't need the

@Suppress("unused") // read by reflection

in future

4.2.1 is released.

Was this page helpful?
0 / 5 - 0 ratings