Does anyone knows how to implement dependency on t...
# gradle
i
Does anyone knows how to implement dependency on test target of shared module in KMM? For example. I have
shared
module and feature-modules. shared • androidMain • commonMain • commonTest • iosMain feature1 • commonMain • commonTest feature2 • commonMain • commonTest i want to use code from shared-commonTest in featureN-commonTest. When i implement shared module in feature module i haven’t this possibility even if i implement
shared
in featureN
commonTest
target
for example feature
kotlin
block
Copy code
kotlin {
    android()
    iOS()
    sourceSets {
        val commonMain by getting {
            dependencies {
                implementation(project(":lib:shared"))
                ...
            }
        }
        val commonTest by getting {
            dependencies {
               implementation(project(":lib:shared"))
            }
        }
    }
}
t
probably the best solution would be to move shared test code into separate multiplatform module
👍 1
c
The test code doesn't end up in a library. You could try creating a jar with classifier test and use as a testImplementation dependency.
i
Thank you both, I understood how should it be