is there a Kotlin Multiplatform equivalent for the...
# gradle
a
is there a Kotlin Multiplatform equivalent for the Java Test Fixtures plugin? I want to share test helpers between subprojects, per target platform (so there would be jvmTestFixtures, jsTestFixtures, etc).
v
Not that I'm aware of, but afair the plugin mainly defines a feature variant and provides a helper method to request that variant's capability. So probably not too hard to replicate.
sharing multiplatform to multiplatform could probably be done similarly
a
thanks @ephemient, that looks promising
what’s the difference between the
jvmTestRuntimeClasspath
config and the
runtimeDependencyFiles
? Do the dependency files contain the test classes themselves?
Copy code
val parent = configurations.getByName("jvmTestRuntimeClasspath")
extendsFrom(parent)
Copy code
jvmTestFixtures(compilations.getByName("test").runtimeDependencyFiles)
e
yes, but that's probably not something you need, I'm just re-exporting the test cases so I can re-run them in another project
(which would normally be a pointless thing to do, why run the same test multiple times; it only makes sense in my example because I'm recompiling it with graalvm)
under normal circumstances you'd more likely want test to depend on testFixtures
a
gotcha, thanks
it exposes the test classes like yours did too, just to test to see if it works first
I think it’s working, at least the unit tests are passing, but IntelliJ isn’t happy. It doesn’t recognise that there’s a dependency
basically I just ignore the IDE. as long as it builds it's right
v
Why not extracting the helpers into its own module?
a
1. I'm updating the Gradle config of an existing code base and I wanted to avoid making too many changes 2. the test-fixtures code needs to be able to access
internal
visibility code