Releases: lupuuss/Mokkery
Releases · lupuuss/Mokkery
2.6.1
2.6.0
2.5.1
Changelog:
✨ Improvements
- #19 Preserve generic arguments for a mocked type so that
MockMode.autofill
andMockMode.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 thekotlin.k2.only.bundled.compiler.plugins.enabled
flag in the IDE registry (Shift + Shift
and search forRegistry
) .
2.5.0
Changelog:
🚀 Features
- #34 Now it is possible to intercept mock calls with
MokkeryCallInterceptor
. Currently, it allows intercepting just before returning an answer. UseMokkeryCallInterceptor.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
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
to1.9.0
2.3.0
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
2.2.0
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 containskotlinx-coroutines
specific answers:everySuspend {...} awaits deferred
- waits for a givenDeferred
and returns its result.everySuspend {...} awaits { deferred }
- waits for aDeferred
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 allDeferred
instances and returns results asList
.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 aChannel
.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
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
Changelog:
Features
- New answers for
Result
returning functions -returnsSuccess(value: T)
andreturnsFailure(error: Throwable)
- New answer for returning arguments -
returnsArgAt(index: Int)
Bug fixes
- Fixes
sequentiallyRepeat
forsuspend
functions being defined for the wrong type - Fixes plugin not being applied by default to source set
test
(Kotlin JVM projects)
2.0.0
Changelog:
Compared to 1.7.0 version
Features
- Mokkery is no longer strictly bound to specific Kotlin version! However, breaking changes in Kotlin compiler API might still occur and it might result in compile time errors.
- Support Kotlin 2.0.0!
- Now it's possible to change spies behavior
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
to1.8.1
- Bumps
atomic-fu
to0.24.0