https://kotlinlang.org logo
#kotest
Title
# kotest
i

igor.wojda

10/09/2023, 5:30 PM
Hey I have recently added KoTest support to Konsist. I am experiencing a strange behaviour and I am hoping someone here will have a clue whats going on. The issue is that tests are failing only for in one particular run due to
NoClassDefFoundError
(this class is actually used by Konsist). It looks like Kotest plugin may have a bug but I want to confirm this: • tests are passing via cmd • tests are passing when running tests for entire class (attached gif) • tests are failing when single test from the same class (attached gif) I have never seen this issue with JUnit 5. Here is the project (this is zipped project on purpose as this may be cache related issue) https://1drv.ms/u/s!AkZ_52b5bWyOgu0ua2wqDfgYcf8onA?e=nekfCV
l

LeoColman

10/09/2023, 5:33 PM
Heh, we were just cheering about it in #kotest-contributors 😄
😄 1
My first guess is that maybe
runJUnitPlatform
wasn't setup correctly, and thus gradle is not executing the test correctly
could you check that?
s

sam

10/09/2023, 5:35 PM
It might be a sourceset issue too, are you doing anything non standard in the gradle file to setup source paths? Also can you paste in that full stack in case I can't duplicate it.
i

igor.wojda

10/09/2023, 5:55 PM
The missing
LightVirtualFile
is used by Konsist and for some reason is not available only for this single test run (attaching stack) In terms of source setes - this is a defualt KMP project. I think I was only touching this part:
Copy code
sourceSets {
        val commonMain by getting
        val commonTest by getting {
            dependencies {
                implementation(kotlin("test"))
            }
        }
        val jvmMain by getting {
            dependencies {
                implementation("io.ktor:ktor-server-netty:2.3.5")
                implementation("io.ktor:ktor-server-html-builder-jvm:2.3.5")
                implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:0.10.0")
            }
        }
        val jvmTest by getting {
            dependencies {
                implementation("com.lemonappdev:konsist:0.13.0")
                implementation("io.kotest:kotest-runner-junit5:5.7.2")
            }
        }

        val jsMain by getting {
            dependencies {
                implementation("org.jetbrains.kotlin-wrappers:kotlin-react:18.2.0-pre.346")
                implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:18.2.0-pre.346")
                implementation("org.jetbrains.kotlin-wrappers:kotlin-emotion:11.9.3-pre.346")
            }
        }
        val jsTest by getting
    }
s

sam

10/09/2023, 5:58 PM
where does LightVirtualFile come from, is this a dependency you add to Konsist ?
i

igor.wojda

10/09/2023, 6:02 PM
yes
org.jetbrains.kotlin:kotlin-compiler:1.9.10
s

sam

10/09/2023, 6:08 PM
Is konsist a compiler plugin ?
i

igor.wojda

10/09/2023, 6:09 PM
nope
(at least not yet)
This dependency is used to parse Kotlin files
s

sam

10/09/2023, 6:10 PM
ok I'll have a play about
it sounds like when we use the single test runner, it doesn't go via gradle sometimes, and the classpath will be wrong
👍 1
you can try flipping the runner to always be gradle in the gradle config in settings
i

igor.wojda

10/09/2023, 6:11 PM
I think it already was set to Gradle
BTW @LeoColman mentioned that this is known issue. I wonder do you have a ticket to track this issue? @sam have you been able to reproduce this locally?
s

sam

10/09/2023, 6:15 PM
I haven't tried yet, as I'm at work atm. Tonight or tomorrow night I should be able to test it out and see what's up. I need to make some unrelated changes to the plugin anyway.
i

igor.wojda

10/09/2023, 6:15 PM
great thx 👌
l

LeoColman

10/09/2023, 6:24 PM
I mentioned this is a known issue? I'm not sure, no
i

igor.wojda

10/09/2023, 7:17 PM
I misread your message @LeoColman,. but now I understand 🙂
@sam any update on this?
2 Views