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

jeggy

10/21/2020, 2:21 PM
Is it possible to extend the test libraries from one project into another project's test libraries? I'm creating a multiproject multiplatform project and I'm using a line like this:
implementation(project(":kgraphql"))
within jvmMain, but it's not possible to get the jvmTest from that project to it's side project. Are there any solutions for this except just copy and paste it?
m

Marc Knaup

10/21/2020, 2:26 PM
This is tricky because of cyclic dependencies. I haven’t found a good way yet. Maybe add a regular non-test module and depend on it in all tests? But that would still be cyclic if it depends on your actual “base module”. I think you can also depend on specific source sets from other projects but I forgot how that works.
👍 1
r

russhwolf

10/21/2020, 2:26 PM
I've worked around this by pulling the tests into the main source of a third module, and depending on it from the other two modules test sources.
👍 2
j

jeggy

10/21/2020, 2:44 PM
Thanks for sharing your experience with this. I think I will just copy and paste it instead of creating a fake module to solve it.
m

Marc Knaup

10/21/2020, 2:48 PM
Well it’s not a fake module but a real module. Nothing bad about that and much better than copying. It’s only problematic if that test module has to depend on a module that in turn needs the test module for testing 😄
s

spand

10/21/2020, 2:53 PM
Not sure it works for multiplatform but I think
Copy code
apply plugin: 'java-test-fixtures'
is what you want
r

russhwolf

10/21/2020, 3:32 PM
You can do something like this without running into circular dependency issues
👍 1