When I run the kotest test from the Android Studio...
# kotest
l
When I run the kotest test from the Android Studio "Run test" gutter icon (I have the Kotest plugin installed), it fails correctly by throwing an exception because I forgot to mock an Android dependency. However when I run the same test from the command line with Gradle, the same test passes!
Copy code
./gradlew :myapp:uicomponents:color-light-detail:testDevDebug --tests LightColorTemperatureViewModelKotest

> Task :myapp:uicomponents:color-light-detail:testDevDebugUnitTest

com.myapp.uicomponents.colorlight.LightColorTemperatureViewModelKotest > when initial light values have temperature then emit correct light values PASSED

BUILD SUCCESSFUL in 10s
The exception thrown when running the test from the gutter icon:
Copy code
android/graphics/Color
java.lang.NoClassDefFoundError: android/graphics/Color
	at com.myapp.uicomponents.colorlight.LightColorTemperatureViewModel$1.<init>(LightColorTemperatureViewModel.kt)
	at com.myapp.uicomponents.colorlight.LightColorTemperatureViewModel$1.<clinit>(LightColorTemperatureViewModel.kt)
	at com.myapp.uicomponents.colorlight.LightColorTemperatureViewModel.<init>(LightColorTemperatureViewModel.kt:81)
	at com.myapp.uicomponents.colorlight.LightColorTemperatureViewModelKotest$1$1$1.invokeSuspend(LightColorTemperatureViewModelKotest.kt:87)
I'm using JUnit engine and kotest 5.1.0
Copy code
val kotestVersion = "5.1.0"
    testImplementation("io.kotest:kotest-runner-junit5:$kotestVersion")