Repository navigation
fix(build): keep kotlin-test-junit on the sample JVM test classpath - #181
Merged
xelon-ua merged 1 commit intoDec 3, 2026
Merged
Conversation
The legacy kotlin-test-annotations-common dependency makes the Kotlin Gradle plugin add a second kotlin-test to commonTest when that configuration is first resolved. The plugin picks the JVM framework variant with singleOrNull(), so if another target's test classpath (iOS) is resolved before jvmTest, it sees two entries, adds no capability and kotlin.test.Test is missing. kotlin-test already provides the common annotations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
:table-sample:compileTestKotlinJvmfailed withUnresolved reference 'Test'when the same Gradle run also compiled the iOS tests.Root cause:
kotlin-test-annotations-commonincommonTestmakes the Kotlin Gradle plugin add a secondkotlin-testto that configuration on its first resolution. The plugin then selects the JVM framework variant withsingleOrNull()over all inheritedkotlin-testdependencies. If the iOS test classpath resolves first, it finds two, skips the capability, andkotlin-test-junitdrops off the JVM test classpath.Changes
kotlin-test-annotations-commondependency fromtable-sample(kotlin-testcovers it) and its now unused catalog entry.Testing
:table-sample:compileTestKotlinIosSimulatorArm64 :table-sample:compileTestKotlinJvm; the resolved JVM test classpath had nokotlin-test-junit. It does after the fix../gradlew qualityCheck compileCommonMainKotlinMetadata compileAndroidMain compileKotlinJs compileKotlinWasmJs compileTestKotlinIosSimulatorArm64 :table-sample-android:assembleDebug jvmTest :table-sample:cleanCompileTestKotlinJvm --continue --no-build-cache: failed before, passes now.:table-sample:compileTestKotlinJs :table-sample:compileTestKotlinWasmJspass.