Skip to content

Releases: lupuuss/Mokkery

2.6.1

15 Dec 13:48
159214e
Compare
Choose a tag to compare

Changelog:

🐛 Bug fixes

  • #66 Fix compilation crash on mocking type with constructor that has generic parameter

2.6.0

28 Nov 19:38
a4d1684
Compare
Choose a tag to compare

Changelog:

⚠️ Breaking changes

  • Now minimum Kotlin version is 2.1.0.

🐛 Bug fixes

  • #48 Fix compatibility broken by Kotlin 2.1.0

🚧 Known issues

  • #63 signal 11: Segmentation fault when using matchers with methods accepting Objective-C types

2.5.1

12 Nov 19:40
2f0c9c2
Compare
Choose a tag to compare

Changelog:

✨ Improvements

  • #19 Preserve generic arguments for a mocked type so that MockMode.autofill and MockMode.autoUnit work better with generics, especially lambdas.
  • The Gradle plugin warns about potential Kotlin version incompatibilities whenever the major or minor version is higher than the version Mokkery was compiled against. Warning can be disabled by Gradle properties flag dev.mokkery.versionWarnings=false

🐛 Bug fixes

  • Fix MockMany identifier to remove unnecessary type parameter information.
  • Fix Intelij internal error when integrating with Mokkery frontend plugin.
    IntelliJ integration with K2 frontend plugins is currently enabled by default only for first-party plugins (e.g., kotlinx.serialization, Compose). Integration with third-party plugins is experimental and requires disabling the kotlin.k2.only.bundled.compiler.plugins.enabled flag in the IDE registry (Shift + Shift and search for Registry) .

2.5.0

04 Nov 19:52
e5d57c5
Compare
Choose a tag to compare

Changelog:

🚀 Features

  • #34 Now it is possible to intercept mock calls with MokkeryCallInterceptor. Currently, it allows intercepting just before returning an answer. Use MokkeryCallInterceptor.beforeAnswering.register to register interceptor.
  • Add predefined interceptors: MokkeryCallListener, MokkeryCallLogger

🐛 Bug fixes

  • Fix compilation crash when using a type with mixed function and type scope parameters
  • #54 Rename mock internal members to avoid clashes with mocked type members
  • [JVM] Fix ClassCastException whenever trying to mock function that returns Array of generic type.
  • Fix properties super calls for indirect super types were not generated.
  • #53 Add null check before accessing getter
  • Make IR generated fields private (causes a warning in Kotlin 2.1.0)
  • Restore mock names to contain fully qualified names

♻️ Deprecations

  • allowIndirectSuperCalls is scheduled for removal

🌳 Dependencies

  • Bump atomicfu to 0.26.0
  • Bump Kotlin to 2.0.21

2.4.0

06 Oct 17:33
Compare
Choose a tag to compare

Changelog:

🚀 Features

  • New ApplicationRule.All that applies Mokkery for all source sets in a project. Applicable when mocks are extracted to separate project.
  • Adds Wasm-WASI support for mokkery-coroutines

🐛 Bug fixes

  • Adds missing watchosArm32 support
  • #43 Fix kotlin.IllegalStateException: KClass for Objective-C classes is not supported yet
  • #44 Fix ClassCastException when mocking a suspending call with default argument on Kotlin Native

🌳 Dependencies

  • Bump atomicfu to 0.25.0
  • Bump kotlinx.coroutines to 1.9.0

2.3.0

23 Aug 18:37
30eace6
Compare
Choose a tag to compare

Changelog:

Since 2.3.0, Mokkery Gradle plugin is also published to Maven Central (previously it was only published to Gradle Plugin Portal).

🚀 Features

  • New answer - callsCatching #33
  • It's no longer required for classes to have no-args constructor - now it's only required for the constructor to be public #5

🐛 Bug fixes

  • Fix compatibility broken by Kotlin 2.0.20 #9, #24
  • Add missing dependency builder overload for KotlinDependencyHandler #32
  • Fix crash when mocking type with method that returns a value class with generic argument

2.2.0

08 Aug 20:38
Compare
Choose a tag to compare

Changelog:

Features

  • New answers: returnsBy, returnsSuccessBy, returnsFailureBy, throwsBy.
  • New module dev.mokkery:mokkery-coroutines:2.2.0 with coroutine utils. It can be added as a regular dependency. Currently, it only contains kotlinx-coroutines specific answers:
    • everySuspend {...} awaits deferred - waits for a given Deferred and returns its result.
    • everySuspend {...} awaits { deferred } - waits for a Deferred provided by the lambda on each call and returns its result.
    • everySuspend {...} awaits cancellation - waits for a cancellation.
    • everySuspend {...} awaits all(deferred1, deferred2) - waits for all Deferred instances and returns results as List.
    • everySuspend {...} awaits receive(from = channel) - waits for a next element from channel and returns it.
    • everySuspend {...} awaits send(to = channel) { ... } - waits for an element being sent to a Channel.
    • everySuspend {...} awaits delayed(...) - delays for a specified duration and returns a specified value.

Improvements

  • Mokkery no longer depends internally on kotlinx-coroutines. It results in suspend functions being now supported for Wasm WASI!

Dependencies

  • Bumps Kotlin to 2.0.10

Bug fixes

  • Fixes Wasm failing on mocking classes #25

2.1.1

25 Jun 20:42
Compare
Choose a tag to compare

Changelog:

Improvements

  • Improves the default plugin application rule to be more strict. Now, the plugin is applied only to source sets with names that contain 'Test' or are exactly 'test', rather than any names containing 'test' in a case-insensitive manner. This change aims to prevent unnecessary application to source sets that are not test-related but include 'test' in their names, while ensuring proper application to default test source sets in all Kotlin project layouts (Multiplatform, JVM, Android).

Bug fixes

  • Fixes compilation crash when supertype of mocked type contained generic method #10
  • Fixes runtime crash on attempt to mock generic property

2.1.0

20 Jun 22:15
Compare
Choose a tag to compare

Changelog:

Features

  • New answers for Result returning functions - returnsSuccess(value: T) and returnsFailure(error: Throwable)
  • New answer for returning arguments - returnsArgAt(index: Int)

Bug fixes

  • Fixes sequentiallyRepeat for suspend functions being defined for the wrong type
  • Fixes plugin not being applied by default to source set test (Kotlin JVM projects)

2.0.0

31 May 22:16
Compare
Choose a tag to compare

Changelog:

Compared to 1.7.0 version

Features

Improvements

  • Validation on the FIR level instead of IR (Mokkery related errors are recognized faster)

Bug fixes

  • Compilation crash for types with methods that have extension parameter and super (default) call available.

Dependencies

  • Bumps kotlinx-coroutines to 1.8.1
  • Bumps atomic-fu to 0.24.0