Changelog
View Source2.5.0 (2025-09-24)
This release requires Elixir ~> 1.15
use Mockery.Macrowon't inject unnecessary code when:mockeryisn't enabled in configAdded
:suppress_dialyzer_warningsoption touse Mockery.Macro, see documentation for detailsAdded
Mockery.Assertions.assert_called!/3andMockery.Assertions.refute_called!/3- New macros produce improved failure output.
Deprecated
Mockery.Assertions.assert_called/2,Mockery.Assertions.assert_called/3,Mockery.Assertions.assert_called/4,Mockery.Assertions.refute_called/2,Mockery.Assertions.refute_called/3andMockery.Assertions.refute_called/4- Use
Mockery.Assertions.assert_called!/3andMockery.Assertions.refute_called!/3instead - Deprecation warnings include a suggested replacement showing the expected syntax (the suggestion is generated from the deprecated call). Note: the suggestion is best-effort and may not exactly match your current code — verify and adjust as needed.
- Use
Improved
Mockery.mock/3- Added typespecs.
- It will now raise immediately if the mocked function does not exist. Previously,
Mockery.Errorwas raised from the proxy module. - It will now raise immediately if a dynamic mock has an invalid arity. Previously,
Mockery.Errorwas raised from the proxy module.
2.4.1 (2025-09-19)
- Fix: Deprecation warning for mockable/2 was crashing for Elixir < 1.14
2.4.0 (2025-09-09)
Deprecated
Mockery.of/2function.- Tuple calls used by this function won't be officially supported in Mockery v3.
Users should migrate to the macro-based alternative in
Mockery.Macro.
- Tuple calls used by this function won't be officially supported in Mockery v3.
Users should migrate to the macro-based alternative in
Mockery.Macro.mockable/2based onMix.env/0is deprecated.- Set
config :mockery, enable: trueinconfig/test.exsand recompile your project.
- Set
Added
Mockery.Macro.defmock/2andMockery.Macro.defmock/3macrosAdded macros and functions from
Mockery.Assertionstolocals_without_parensin.formatter.exs
2.3.4 (2025-08-15)
- Fixed warnings (Elixir 1.18)
2.3.3 (2024-07-04)
Added
use Mockery.Macroto solve new Elixir warnings- Replace
import Mockery.Macrobyuse Mockery.Macro
- Replace
2.3.2 (2024-07-03)
- Added missing () to fix warnings
2.3.1 (2019-10-10)
- Fixed issue preventing module attributes to be used in assert_called macros #34
2.3.0 (2018-10-22)
- Allowed multiple mocks when using pipe operator or nested calls #27
- Deprecated
Mockery.History.enable_history/1in favor ofMockery.History.enable_history/0andMockery.History.disable_history/0
2.2.0 (2018-06-17)
- Added
Mockery.Macro.mockable/2macro as alternative way to prepare module for mocking - Deprecated
Mockery.new/2
2.1.0 (2018-02-19)
- Added
Mockery.new/2 - Fixed typo in error message #21
- Removed support for Elixir 1.1 and 1.2
2.0.2 (2017-10-25)
- Fixed
Mockery.of/2typespecs
2.0.1 (2017-10-13)
- When Mix is missing,
Mockery.of/2assumes that env is:prod
2.0.0 (2017-10-08)
Removed
Mockery.Heritage- Global mocks will be handled without macros by pure elixir modules.
- Some new restrictions have been added for global mock modules (see global mock section in README)
Changed
Mockery.mock/3when value is function (dynamic mock)[function_name: arity]syntax remains unchanged:function_namesyntax will raise error
Changed
Mockery.of/2output- run
mix compile --forcewhen upgrading from Mockery 1.x.x
- run
1.4.0 (2017-10-02)
Mockery.mock/2andMockery.mock/3are now chainable
1.3.1 (2017-09-21)
- Minor format fix in
Mockery.Historyfailure messages
1.3.0 (2017-09-15)
- Added string version for
Mockery.of/2(now recommended) - Fixed mocking of erlang modules
1.2.0 (2017-09-13)
- Introduced
Mockery.History
1.1.1 (2017-09-05)
More descriptive errors (when args are not list) for:
Removed unnecessary
Elixir.namespace from module names in error messages
1.1.0 (2017-08-07)
- Added
Mockery.mock/2(Mockery.mock/3value defaults to:mocked) - Added
Mockery.Assertions.assert_called/4macro - Added
Mockery.Assertions.refute_called/4macro
1.0.1 (2017-08-02)
- Fixed issue when mocking with
nilorfalse
1.0.0 (2017-07-30)
- Added
use Mockeryfor importing bothMockeryandMockery.Assertions - Added
Mockery.Assertions.refute_called/2andMockery.Assertions.refute_called/3 - Loosen elixir version requirement from
~> 1.3to~> 1.1