Setup
- Apply Gradle plugin:
plugins {
kotlin("multiplatform") version "1.9.24" // ...or any other Kotlin plugin
id("dev.mokkery") version "1.9.24-1.7.0"
}
-
Ensure that your Mokkery version is compatible with Kotlin version. Refer to compatibility section.
-
Check targets section to make sure that all targets from you multiplatform project are supported.
-
At this point everything should be fine. In case of Gradle being unable to find dependencies, check missing repositories.
// for runtime dependencies
repositories {
mavenCentral()
}
// for plugin dependencies
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}
Source setsโ
By default, Mokkery is applied to all Kotlin source sets in the project that contain the "Test" phrase. To change this behavior, you can provide a different rule in your Gradle file:
plugins {
id("dev.mokkery")
}
mokkery {
rule.set(ApplicationRule.Listed("jvmTest")) // this rule affects only jvmTest
rule.set(ApplicationRule.MatchesName(Regex("macos.*Test"))) // this rule affects all "macos.*Test" source sets
rule.set { sourceSet -> sourceSet.name.endsWith("Test") } // this rule affects all ".*Test" source sets
}
Targetsโ
โ Supported:
- โ JVM & Android
- ๐ง All 3 tiers of Kotlin Native targets
- ๐ JS (Browser, Node.js)
- ๐งช Wasm-JS (Browser, Node.js)
- ๐งช Wasm-WASI (Node.js)
You can refer to this file for more details.
Compatibilityโ
Warning Mokkery 2.0.0 pre-releases are not locked to specific Kotlin pre-release and optimistically assume that compiler API is not going to change. However, breaking changes might happen and result in compile-time errors.
Mokkery version | Supported Kotlin version | Plugin version |
---|---|---|
2.0.0-RC1 | 2.0.0-RC2+ | "2.0.0-RC1" |
1.7.0 | 1.9.24, 1.9.23 | "$kotlinVersion-1.7.0" |
1.6.1 | 1.9.23 | "$kotlinVersion-1.6.1" |
1.6.0 | 1.9.23 | "$kotlinVersion-1.6.0" |
1.5.0 | 1.9.23, 1.9.22 | "$kotlinVersion-1.5.0" |
1.4.0 | 1.9.22, 1.9.21, 1.9.20 | "$kotlinVersion-1.4.0" |
1.3.2 | 1.9.22, 1.9.21, 1.9.20 | "$kotlinVersion-1.3.2" |
1.3.1 | 1.9.22, 1.9.21, 1.9.20 | "$kotlinVersion-1.3.1" |
1.3.0 | 1.9.20, 1.9.10, 1.9.0, 1.8.22, 1.8.21, 1.8.20 | "$kotlinVersion-1.3.0" |
1.2.0 | 1.9.0, 1.8.22, 1.8.21, 1.8.20 | "$kotlinVersion-1.2.0" |
1.1.0 | 1.9.0, 1.8.22, 1.8.21, 1.8.20 | "$kotlinVersion-1.1.0" |
1.0.1 | 1.9.0, 1.8.22, 1.8.21, 1.8.20 | "$kotlinVersion-1.0.1" |