https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
c

Ciaran Sloan

08/18/2022, 12:45 PM
I have a few modules in my kmm layer but seem to be having an issue with visiblity in my tests. • I have module
A
which contains a
myFunction()
function in the
commonTest
• Module
B
is dependent on module
A
but I do not have access to
myFunction()
in module Bs
commonTest
. It is not available for import. Module
B
however does have access to module `A`s classes and functions within
commonMain
but the issue seems to be in the
commonTest
only. Is this expected? Or how can I ensure that each module that implements module
A
also gets access to its public classes and functions within
commonTest
?
I am declaring moduleA in the
commonTest
dependencies like so:
module-b/build.gradle.kts
Copy code
sourceSets["commonTest"].dependencies {
        implementation(project(":moudle-a"))
    }
I guess I can workaround this by making a
core-test
module and leaving the functions/casses I want exposed in
commonMain
of that module, but this feels like a workaround rather than the solution
g

Grégory Lureau

08/18/2022, 1:46 PM
Afaik it's the standard approach for Java projects, test code is not part of the module, and it's not automatically loaded via dependency. As your workaround, I use a couple of test modules to share common test tools/dependencies.
2 Views