I can't get default configuration via `AbstractPro...
# kotest
a
I can't get default configuration via
AbstractProjectConfig
to work. According to the docs, Kotest should automatically find these classes on the classpath and apply their configs to specs. Are there any undocumented requirements for this to work? For example, should this test case pass?
Copy code
object KotestConfig : AbstractProjectConfig() {
    override val isolationMode = IsolationMode.InstancePerLeaf
}

class KotestConfigSpec : StringSpec({
    "uses leaf isolation mode" {
        assertEquals(IsolationMode.InstancePerLeaf, isolationMode())
    }
})
• Kotlin JVM 1.7.10 • Gradle 7.5.1. • Kotest 5.5.1 (
io.kotest:kotest-runner-junit5-jvm
) • No custom
kotest.properties
c
I think it should work. you could try setting a breakpoint in your config class.
a
Yeah, debugger stops at config breakpoints. 👍
It looks I picked a wrong minimal case to verify my actual problem.🤦‍♂️ `isolationMode()`:
Returns the
IsolationMode
to be used by the test engine when running tests in this spec. If null, then the project default is used.
So, if I understand correctly, it'd return null no matter what, unless I set it explicitly in a spec.
s
That seems a bug. It should use the project config value.
a
I thought so too, but it looks correct after looking at JvmSpecExecutorDelegate
Copy code
private fun Spec.resolvedIsolationMode() =
      this.isolationMode() ?: this.isolationMode ?: configuration.isolationMode
Spec.isolationMode
field is not set within the framework, it's only a configuration value that's resolved later on by the delegate.