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.33 score 104 stars 4 packages 655 scripts 48k downloads 7 exports 23 dependencies

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

TargetResultTimeFilesSyslog
linux-devel-x86_64OK143
source / vignettesOK208
linux-release-x86_64OK138
macos-release-arm64OK133
macos-oldrel-arm64OK104
windows-develOK111
windows-releaseOK72
windows-oldrelOK83
wasm-releaseOK106

Exports:expect_argsexpect_callexpect_calledmockmock_argsmock_callsstub

Dependencies:briocallrclicrayondescdiffobjevaluatefsgluejsonlitelifecyclemagrittrpkgbuildpkgloadpraiseprocessxpsR6rlangrprojroottestthatwaldowithr

Mocks: Integrating with testthat

Rendered frommocks-and-testthat.Rmdusingknitr::rmarkdownon May 12 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