Skip to main content

Setup

  1. Apply Gradle plugin:
plugins {
kotlin("multiplatform") version "2.0.0" // ...or any other Kotlin plugin
id("dev.mokkery") version "2.0.0"
}
  1. Ensure that your Mokkery version is compatible with Kotlin version. Refer to compatibility section.

  2. Check targets section to make sure that all targets from you multiplatform project are supported.

  3. 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:

You can refer to this file for more details.

Compatibilityโ€‹

Warning Mokkery 2.* versions are not locked to specific Kotlin 2.* versions and optimistically assume that compiler API is not going to change. However, breaking changes might happen and result in compile-time errors. You can track compiler API stability here.

Mokkery versionSupported Kotlin versions
2.0.02.0.0+