Why IntelliJ Kotest plugin does not work well?

I've installed the Kotest plugin (1.1.22-IC-2020.3) for IntelliJ (2020.3). It allows me to create Kotest tests for/from my Kotlin classes, but those tests are not runnable from the test classes.

The kotest panel showing as if no test are present

If I create a new Kotest run configuration I can run the test class, but this exception is always thrown:

java.lang.NoClassDefFoundError: Could not initialize class io.kotest.core.test.TestResult
    at io.kotest.core.runtime.TestCaseExecutor.executeActiveTest(TestCaseExecutor.kt:127)
    at io.kotest.core.runtime.TestCaseExecutor$intercept$2.invokeSuspend(TestCaseExecutor.kt:75)
    at io.kotest.core.runtime.TestCaseExecutor$intercept$2.invoke(TestCaseExecutor.kt)
    at io.kotest.core.runtime.TestCaseExecutor.executeIfActive(TestCaseExecutor.kt:89)
    at io.kotest.core.runtime.TestCaseExecutor.intercept(TestCaseExecutor.kt:75)
    at io.kotest.core.runtime.TestCaseExecutor.execute(TestCaseExecutor.kt:56)
    at io.kotest.core.engine.SingleInstanceSpecRunner.runTest(SingleInstanceSpecRunner.kt:60)
    at io.kotest.core.engine.SingleInstanceSpecRunner$execute$2$invokeSuspend$$inlined$invoke$lambda$1.invokeSuspend(SingleInstanceSpecRunner.kt:70)
    at io.kotest.core.engine.SingleInstanceSpecRunner$execute$2$invokeSuspend$$inlined$invoke$lambda$1.invoke(SingleInstanceSpecRunner.kt)
    at io.kotest.core.engine.SpecRunner$runParallel$$inlined$map$lambda$1$1.invokeSuspend(SpecRunner.kt:51)
    at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
    at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56)
    at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:274)
    at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:79)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:54)
    at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
    at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:36)
    at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
    at io.kotest.core.engine.SpecRunner$runParallel$$inlined$map$lambda$1.run(SpecRunner.kt:50)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)

The test class compiles and the jar kotest-core-jvm-4.1.1.jar is included as external library.

Can someone give some advice on this?

Upvotes: 3

Views: 3056

Answers (1)

sksamuel
sksamuel

Reputation: 16397

According to the docs, you need 4.2 or higher and you're using 4.1.1. I would recommend you use 4.3.2.

To use the intellij plugin you need to add the kotest-framework-engine-jvm dependency to your build. If you are using the gradle support as well (eg for CI or running at the command line) and you have added kotest-runner-junit5-jvm then that will bring in the required dependencies transitively.

Upvotes: 2

Related Questions