Does anybody know what that actually means: ```FAI...
# compose-desktop
m
Does anybody know what that actually means:
Copy code
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':shared:compileTestKotlinDesktop'.
> Could not resolve all files for configuration ':shared:desktopTestCompileClasspath'.
   > Could not resolve org.jetbrains.kotlin:kotlin-test:1.8.20.
     Required by:
         project :shared
      > Unable to find a variant of org.jetbrains.kotlin:kotlin-test:1.8.20 providing the requested capability org.jetbrains.kotlin:kotlin-test-framework-junit:
           - Variant compile provides org.jetbrains.kotlin:kotlin-test:1.8.20
           - Variant runtime provides org.jetbrains.kotlin:kotlin-test:1.8.20
           - Variant sources provides org.jetbrains.kotlin:kotlin-test:1.8.20
           - Variant javadoc provides org.jetbrains.kotlin:kotlin-test:1.8.20
           - Variant platform-compile provides org.jetbrains.kotlin:kotlin-test-derived-platform:1.8.20
           - Variant platform-runtime provides org.jetbrains.kotlin:kotlin-test-derived-platform:1.8.20
           - Variant enforced-platform-compile provides org.jetbrains.kotlin:kotlin-test-derived-enforced-platform:1.8.20
           - Variant enforced-platform-runtime provides org.jetbrains.kotlin:kotlin-test-derived-enforced-platform:1.8.20
I am sure my tests worked until recently. They are plain unit tests. Not composable function tests. How do you configure tests properly in a compose multiplatform context? Most of the Jetbrains examples don’t seem to configure any tests at all.
e
add either
org.jetbrains.kotlin:kotlin-test-junit
or
org.jetbrains.kotlin:kotlin-test-junit5
to your jvm test source set dependencies, depending on the test engine you're using, if
org.jetbrains.kotlin:kotlin-test
is a common test dependency
m
So what’s wrong with
Copy code
val commonTest by getting {
	dependencies {
		implementation(kotlin("test"))
	}
}

val desktopTest by getting {
	dependencies {
		implementation(kotlin("test-junit"))
	}
}
e
should be nothing wrong with that, is that giving you issues?
m
Yes, see above.
e
might need a MCVE or somebody else's input since that works for me in a multiplatform non-compose project
m
After spending a lot of time on this issue it turns out that all these problems are gone as soon as I switch back to Kotlin 1.8.10 (from 1.8.20). This seems to be nothing but a nasty regression with this Kotlin version.
e
works for me in Kotlin 1.8.20 and 1.8.21 blob shrug
m
Just switched to 1.8.21 (had to switch off the compiler compatibility check for that) and VOILA - all my tests work again. This definitely must have been some glitch in Kotlin 1.8.20 although not everybody seems to have suffered.
I finally found the cause for this and it is already known for some time now. (Don’t know why I did not find that earlier.) The issue is related to the use of mavenLocal. See: https://youtrack.jetbrains.com/issue/KT-53484
Copy code
rm -rf ~/.m2/repository/org/jetbrains/kotlin/
Removing kotlin from the .m2 did the trick. The long term solution is to avoid using mavenLocal.