Anand Choudhary
Anand Choudhary

Reputation: 9

Not able to use MockK library in KMM project

Could not resolve io.mockk:mockk:1.13.2 for :shared:iosArm64Test Could not resolve io.mockk:mockk:1.13.2 for :shared:iosSimulatorArm64Test Could not resolve io.mockk:mockk:1.13.2 for :shared:iosX64Test

Found that MockK is only supported for jvm target - https://github.com/mockk/mockk/issues/950

But what i know is the unit tests we write on common shared module are meant to be run on local machine (mac/ windows) which do have have JVM installed.

Please can anyone add some light over here. Thanks

Upvotes: 0

Views: 954

Answers (1)

Kevin Galligan
Kevin Galligan

Reputation: 17342

You can use mockk only in jvm test sources. If you write common code, and you have native targets, it won't work.

So, you can add jvmTest instead of commonTest and write tests in jvmTest that use mockk. However, that won't test your native code directly.

Upvotes: 1

Related Questions