can my e.g. `jsTest` depend on the `commonTest` se...
# multiplatform
t
can my e.g.
jsTest
depend on the
commonTest
set of a different module? i'd like to provide some common test files for several modules...
a
Haven't tried it, but I believe the answer is no, for the same reason as https://kotlinlang.slack.com/archives/C19FD9681/p1559290001004200
t
Well no. i don;t want to add any transitive dependencies. also "it doesn't" make much sense" is not a good reason to forbid it
r
It’s possible to share test code between modules by created a separate
sharedTests
module that defines your tests in
commonMain
, and then depending on
:sharedTests
from the test code of other modules. There’s some rough edges though. For example if you try this in JS on 1.3.40 you’ll very likely run into https://youtrack.jetbrains.com/issue/KT-31917
I had a configuration like that in Multiplatform Settings, but removed it in the 1.3.40 update due to that and another similar issue on native. Currently I share test code via
kotlin.srcDirs()
but the IDE complains when files are duplicated across multiple sourceSets/modules in that way.
t
Thank you! I wonder why sharing code in tests is so hard...