Hey I have recently added KoTest support to <Konsi...
# kotest
i
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
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
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
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
where does LightVirtualFile come from, is this a dependency you add to Konsist ?
i
yes
org.jetbrains.kotlin:kotlin-compiler:1.9.10
s
Is konsist a compiler plugin ?
i
nope
(at least not yet)
This dependency is used to parse Kotlin files
s
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
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
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
great thx 👌
l
I mentioned this is a known issue? I'm not sure, no
i
I misread your message @LeoColman,. but now I understand 🙂
@sam any update on this?
@sam any update here?
s
Can you paste the stack trace, looks like it couldn't find an intellij class. Is this normal intellij or android studio ?
i
Opening it in the newest version of
Android studio
(Iguana | 2023.2.1). Fastest way to reproduct is 1. Checkout this project and Open in Android Studio https://github.com/LemonAppDev/konsist/tree/main/samples/starter-projects/konsist-starter-android-gradle-kotlin-kotest 2. Run tests in
SampleKonsistTest
class
s
I don't have android studio and it never seems work on on my linux box. Can you paste the stack trace you show in the video.
i
I know the linux pain Here is ST:
@sam did you got the chance to look into this?
m
@igor.wojda did you figure out what the issue was?
i
My understanding is that this is the issue inside KoTest Plugin
m
@sam, any updates on this? I think I've had this problem for years and its frankly the only thing that makes me consider not using kotest It means i cannot debug single tests, which is very frustrating
i
I noticed that orginal project link is not working anymore. @sam are you able to reproduce this heaving information above or do you need a sample project?
s
To recap, it's only in Android studio this fails right ?
i
I have only tested this in AS
@Mini what about U?
m
Same I tried to run them in IntelliJ this morning after Sam asked, but the plugin doesnt seem to detect the tests at all so I can't run only one 🤔
s
I use it daily in intellij. Can you take a screenshot
m
Screenshot 2024-10-23 at 07.52.37.png
Any news on this Sam? Its pretttttty frustrating as I can't debug individual tests 😓