Skip to content

mockery

Mocking Library for R

v0.4.5 · Sep 4, 2025 · MIT + file LICENSE

Description

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.

Downloads

CRAN

62.1K

Last 30 days

444th

168.6K

Last 90 days

1.3M

Last year

Trend: +9% (30d vs prior 30d)

r2u CRAN

950

Last 30 days

2.8K

Last 90 days

6.9K

Last year

Trend: -28.1% (30d vs prior 30d)

autoCRAN

11

Last 7 days

99

Last 30 days

5

All-time

⚠ Shared name: this package is also shipped elsewhere on openSUSE, so this count is not exclusive to autoCRAN (it is an upper bound).

conda-forge CRAN

751

Last 30 days

1.7K

Last 90 days

5.5K

Last year

Trend: +48.7% (30d vs prior 30d)

CRAN Check Status

13 OK
Show all 13 flavors
Flavor Status
r-devel-linux-x86_64-debian-clang OK
r-devel-linux-x86_64-debian-gcc OK
r-devel-linux-x86_64-fedora-clang OK
r-devel-linux-x86_64-fedora-gcc OK
r-devel-windows-x86_64 OK
r-oldrel-macos-arm64 OK
r-oldrel-macos-x86_64 OK
r-oldrel-windows-x86_64 OK
r-patched-linux-x86_64 OK
r-release-linux-x86_64 OK
r-release-macos-arm64 OK
r-release-macos-x86_64 OK
r-release-windows-x86_64 OK

Check History

OK 14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE Mar 10, 2026

Code

Structure

Lines of code

1,510

Files

22

Compiled share

0%

Has compiled src

No

Language breakdown

R 476 (31.5%)Tests 540 (35.8%)Docs 250 (16.6%)Vignettes 244 (16.2%)

API

Exported functions

7

Internal functions

8

Testing & CI

Has tests

Yes

Test-to-code ratio

1.13

testthat edition

CI present

No

CI type

[]

PR gated

No

Docs

Return-value doc rate

33.3%

\dontrun example ratio

0%

Roxygen coverage

100%

Has pkgdown

No

NEWS present

Yes

Health & Security signals

Informational signals; not verdicts.

on.exit coverage

0%

Unsafe pattern score

9

Dep constraint coverage

0%

Secret pattern count

0

Bundled 3rd-party code

2 items

Portability & License

Min R version

3.6

System requirements

C++ standard

License

MIT + file LICENSE

License flags

SPDX valid, OSI approved

History

Versions

9

First release

2016-10-25

Latest release

2025-09-04

Avg cadence

353 days

Cold removal rate

100%

Dep drift

1

LOC over versions

v0.2.0: 1,552 LOCv0.3.0: 1,340 LOCv0.4.0: 1,480 LOCv0.4.1: 1,487 LOCv0.4.1.1: 1,487 LOCv0.4.2: 1,500 LOCv0.4.3: 1,540 LOCv0.4.4: 1,542 LOCv0.4.5: 1,510 LOC

Per-file churn detail lives in the source pipeline: https://github.com/r-observatory/cran-code-metrics.

Reverse Dependencies (168)

suggests

Argentum DSMolgenisArmadillo GitStats LBDiscover MassWateR MolgenisArmadillo MolgenisAuth NHSRplotthedots ORscraper PKPDsim PhilipsHue RCognito REDCapDM ROCaggregator RTD RedditExtractoR ReliaLearnR Rglottography Rmoji SAME SkeletalVis TCRconvertR ZonationR aNCA abba activatr admix and asciicast azlogr bage biometryassist bootGOF box.lsp camtrapR carbonpredict causalDisco cfid civis clc climatehealth confcons connector.databricks connector.sharepoint contentanalysis convertid courieR covidcast cpp11 cpp11armadillo cpp11eigen cranlike crayon cucumber cvdprevent dadjokeapi data.tree debugme droll dsTidyverse dwctaxon easystats emburden epiviz fastbioclim fipio fledge formr ggpedigree ggreveal gipsDA gitcreds glasstabs golem googleCloudVisionR hbsaems hypothesis iRfcb imagefluency installr ip2location.io junco labNorm lacrmr languageserver mailmerge mcmcensemble metainsight miniCRAN mixR mmrm mobsim myIO nanoparquet natmanager newsanchor nlrx npi odin openaq opencage optedr orderly ottr packrat pacs pairwiseLLM pathfindR paws.common pins pipeflow pkgdepends pkgsearch plinkQC prettycode prompt pudu quallmer r5rgui rcmdcheck reactable.extras redcapAPI remotes resourcecode restez rhino rhub risk.assessr riskdiff rixpress rlmstudio roxytypes rsynthbio sankey sasr secret sentixr sentryR shelter shiny.semantic shiny2docker shinyobjects sigugr simpleMH smdocker starburst sunburstShinyWidget supabaseR surveytidy syncdr taxodist test.assessr textAnnotatoR tflmetaR tracer ukbflow vaultr vectorsurvR vetiver waetr whoami wildmeta xaringanthemer xml2 yfinancer zoltr

Dependency Network

Dependencies Reverse dependencies testthat gitear shiny.ollama Argentum DSMolgenisArmadillo GitStats LBDiscover MassWateR MolgenisArmadillo MolgenisAuth NHSRplotthedots ORscraper PKPDsim PhilipsHue RCognito REDCapDM +153 more reverse deps mockery

Version History

10 tracked
new 0.4.5 Mar 10, 2026
updated 0.4.5 ← 0.4.4 diff Sep 3, 2025
updated 0.4.4 ← 0.4.3 diff Sep 25, 2023
updated 0.4.3 ← 0.4.2 diff Feb 19, 2022
updated 0.4.2 ← 0.4.1.1 diff Sep 3, 2019
updated 0.4.1.1 ← 0.4.1 diff Aug 18, 2018
updated 0.4.1 ← 0.4.0 diff Nov 9, 2017
updated 0.4.0 ← 0.3.0 diff Nov 6, 2017
updated 0.3.0 ← 0.2.0 diff Dec 15, 2016
new 0.2.0 Oct 24, 2016