Hi! Is it possible that kotest 6.x doesn't work we...
# kotest
p
Hi! Is it possible that kotest 6.x doesn't work well with Gradle's Configuration Cache, or some extra piece of config is needed? see this CI run, I'm getting:
Copy code
- Task `:linuxX64Kotest` of type `io.kotest.framework.gradle.tasks.KotestNativeTask`: cannot serialize object of type 'org.gradle.api.DefaultTask', a subtype of 'org.gradle.api.Task', as these are not supported with the configuration cache.
  See <https://docs.gradle.org/8.14.3/userguide/configuration_cache.html#config_cache:requirements:task_access>
- Task `:linuxX64Kotest` of type `io.kotest.framework.gradle.tasks.KotestNativeTask`: cannot serialize object of type 'org.gradle.api.internal.project.DefaultProject', a subtype of 'org.gradle.api.Project', as these are not supported with the configuration cache.
  See <https://docs.gradle.org/8.14.3/userguide/configuration_cache.html#config_cache:requirements:disallowed_types>
- Task `:linuxX64Kotest` of type `io.kotest.framework.gradle.tasks.KotestNativeTask`: cannot serialize object of type 'org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeHostTest', a subtype of 'org.gradle.api.Task', as these are not supported with the configuration cache.
When I turn off Configuration Cache, this problem is gone.
I see in @Bernd Prünster’s PoC project using newest kotest that CC is enabled (ref), which makes me think my problem is project-specific, but I don't know how to approach debugging it
b
Sam will update that project with the next Kotest release. It is still somewhat dodgy at the moment. I'd wait until then for a proper reference project
👍 1
🙇 1
oh, he did open a PR already. somehow this got lost between my dozens of other notifictaions. gimme a sec…
👍 1
I'm just verifying locally what is and isn't working and I'll then also push a readme
well, can't get it to work with all targets. trying the reduced variant now
no dice…
the default test tasks don't invoke kotest. use the Kotest tasks (such as
jvmKotest
) and things should start working again
p
the default test tasks don't invoke kotest
is it by design or a temporary problem?
b
Sam knows more. From what I gathered, the default test tasks have issues, so that was the solution. Also: it should give you the flexibility to mix and match test Frameworks. But not all the dust has settled yet
s
In Kotest 6 for JVM you can run test or use the new gradle plugin and run kotest. The latter is better as it has proper support for all the things junit support lacks. But the former still works if you just want to use out of the box gradle
For KMP you will need to use linuxX64Kotest instead of linuxX64Test for example. That is because KMP support is much improved including running single tests from the IDE
The docs are partially updated and will be completely updated once 6.0 is out tomorrow
p
For KMP, as long as there's a boilerplate-free way of setting up the tests so that they are run when building the project, it sounds fine
s
There is. The sample project has a pr up