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

Nick

03/15/2021, 1:21 AM
Is it possible to exclude jsTest target from a MPP library? I have my tests in commonTest and would like to use jvmTest as the only target. But jsTest is included by default. This is an issue because the mock library I use does not have a JS (IR) version.
t

travis

03/15/2021, 7:24 AM
You could simply move any tests that utilize your mock library into
jvmTest
?
m

Mustafa Ozhan

03/15/2021, 10:58 AM
what if you keep your test classes all in
jvmTest
folder ?
n

Nick

03/15/2021, 3:20 PM
Tests are actually all in commonTest now. And I simply execute the JVM version of these tests (since common tests need to run on a platform). This is the setup I want, since the stuff being tested is really common code. Moving the mock dependency to jvmTest seems like an option; just wondering if there's an alternative.
m

Mustafa Ozhan

03/15/2021, 3:35 PM
Another alternative is probably editing the gradle task you use for it ie. instead of
:common:allTests
or
:common:test
you should run
:common:jvmTest
n

Nick

03/15/2021, 3:38 PM
Running only jvm makes sense, and is what I do now. But the issue is building. I need to exclude jsTest otherwise I can't build b/c of the common dependency on mocking. So wondering if it is possible to remove jsTest target alltogether.
m

Mustafa Ozhan

03/15/2021, 3:39 PM
So then not sure if it is recommended but you need to have these kind of stuff in your gradle. https://stackoverflow.com/a/47341346/8334146
r

russhwolf

03/15/2021, 3:46 PM
If you have tests that are defined in common and you want to run them only on the jvm, you'll be fighting the default gradle configuration the whole time. You can probably make it work, but it'll be a pain to manage any time something goes wrong. You'll almost certainly have an easier time if the tests that can only run on the jvm are defined in the jvm source set.
2
2 Views