Package: mockery 0.4.5.9000

Hadley Wickham

mockery: Mocking Library for R

The two main functionalities of this package are creating mock objects (functions) and selectively intercepting calls to a given function that originate in some other function. It can be used with any testing framework available for R. Mock objects can be injected with either this package's own stub() function or a similar with_mocked_binding() facility present in the 'testthat' package.

Authors:Noam Finkelstein [aut], Lukasz Bartnik [aut], Jim Hester [aut], Hadley Wickham [aut, cre]

mockery_0.4.5.9000.tar.gz
mockery_0.4.5.9000.zip(r-4.7)mockery_0.4.5.9000.zip(r-4.6)mockery_0.4.5.9000.zip(r-4.5)
mockery_0.4.5.9000.tgz(r-4.6-any)mockery_0.4.5.9000.tgz(r-4.5-any)
mockery_0.4.5.9000.tar.gz(r-4.7-any)mockery_0.4.5.9000.tar.gz(r-4.6-any)
mockery_0.4.5.9000.tgz(r-4.6-emscripten)
manual.pdf |manual.html
card.svg |card.png
mockery/json (API)
NEWS

# Install 'mockery' in R:
install.packages('mockery', repos = c('https://r-lib.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/r-lib/mockery/issues

On CRAN:

Conda:

11.53 score 104 stars 4 packages 844 scripts 59k downloads 7 exports 24 dependencies

Last updated from:ede3789ae1. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK123
source / vignettesOK169
linux-release-x86_64OK123
macos-release-arm64OK74
macos-oldrel-arm64OK88
windows-develOK85
windows-releaseOK76
windows-oldrelOK67
wasm-releaseOK104

Exports:expect_argsexpect_callexpect_calledmockmock_argsmock_callsstub

Dependencies:briocallrclicrayondescdiffobjevaluatefsgluejsonlitelifecyclemagrittrotelpkgbuildpkgloadpraiseprocessxpsR6rlangrprojroottestthatwaldowithr

Mocks: Integrating with testthat

Rendered frommocks-and-testthat.Rmdusingknitr::rmarkdownon Jun 11 2026.

Last update: 2025-09-03
Started: 2016-10-21

Readme and manuals

Help Manual

Help pageTopics
R package to make mocking easiermockery-package mockery
Expectation: does the given call match the expected?call-expectations expect_args expect_call expect_called
Create and query a mocked function.length.mock mock mock_args mock_calls
Replace a function with a stub.stub