Skip to content

mockthat

0.2.8

Function Mocking for Unit Testing

4packages depend
11.6Kdownloads / year
90.3%test coverage
13/13checks pass

Overview

About
Maintained by Nicolas BennettFirst published 2020-12-093 releasesCRAN page ↗GitHub ↗

With the deprecation of mocking capabilities shipped with 'testthat' as of 'edition 3' it is left to third-party packages to replace this functionality, which in some test-scenarios is essential in order to run unit tests in limited environments (such as no Internet connection). Mocking in this setting means temporarily substituting a function with a stub that acts in some sense like the original function (for example by serving a HTTP response that has been cached as a file). The only exported function 'with_mock()' is modeled after the eponymous 'testthat' function with the intention of providing a drop-in replacement.

Install

Health

CRAN checks
13OK
Slowest check: 51 s · r-oldrel-windows-x86_64
Code health
Yes
Tests · ratio 0.81
90.3%
Coverage · measured lines
100%
Documentation · exports
2
Dependencies · direct
Check history
  • OK2026-08-05
    13 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE
  • NOTE2026-08-01
    12 OK · 1 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE
  • OK2026-03-10
    14 OK · 0 NOTE · 0 WARNING · 0 ERROR · 0 FAILURE

Documentation

Documentation
READMEYes · 389 wordsVignettesNopkgdown siteNoNEWSYes · 100% structuredCode of conductNoContributing guideNo
Examples that run
100%
Documented parameters
100%
Return-value docs
100%
References docs
0%

Downloads

11.6K
CRAN downloads in the past year
Rank #4,374 · ~32/day · ~970/mo
Daily download trend is not available in this view yet.
31630 days
1.8K90 days
11.6K1 year
Compare downloads with other packages →
Also on104 r2u9 autocran572 conda_forge

Repository

Repository
14Stars
1Forks
7Open issues
0Open PRs
0Releases
61Commits
2Contributors
61 commits · Last activity 2022-10-31

Stars over time

2023-09-13 · 142026-07-07 · 14

Repository practices

Upstream repositoryBeta

3 development-tooling and community-health practices detected across 3 families in the upstream repository

Checks run against github.com/nbenn/mockthat on 2026-08-16.

Continuous integration (1)
GitHub Actions
CRAN release process (1)
cran-comments.md
Docs source (1)
README.Rmd
How this is detected·Detection ruleset v1 (2026-07-18)

Dependencies

Declared dependencies
6 external dependencies (excludes base and recommended)
Depends (1)
R >= 3.3.0
Imports (2)
utilsrlang
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
4direct
0indirect

Code & Tests

People & History

People (1)
Maintainer (1)
Author, Maintainer
Authors (1)
Author, Maintainer
Package Timeline

3 releases. Pick two to compare their code metrics. R releases are shown for context.

  • R
    R 4.6.0 released · 2026-04-24
  • R
    R 4.5.0 released · 2025-04-11
  • R
    R 4.4.0 released · 2024-04-24
  • R
    R 4.3.0 released · 2023-04-21
  • 0.2.8Latest
    2022-11-01 · current release · diff ↗
  • unarchivedReturned to CRAN
    2022-11-01
  • archivedRemoved from CRAN
    2022-10-18
    issues were not corrected in time
  • R
    R 4.2.0 released · 2022-04-22
  • R
    R 4.1.0 released · 2021-05-18
  • 0.2.6
    2021-04-23 · diff ↗
  • 0.2.4
    2020-12-09
  • R
    R 4.0.0 released · 2020-04-24

Package metadata

First published
2020-12-09
Total releases
3 / 6 yrs
License
MIT + file LICENSE OSI
Minimum R
≥ 3.3.0
Download size
13 KB
Installed size
not tracked yet
With dependencies
not tracked yet

Cite

Cite this package

Run in R for the authors' preferred citation:

citation("mockthat")
Bennett, N. (2022). mockthat: Function Mocking for Unit Testing (Version 0.2.8) [Computer software]. https://doi.org/10.32614/CRAN.package.mockthat

This is what citation() produces when a package has no citation file of its own. If it prints something else, use that.

Cite the R Observatory

For a number measured here: a download total, a coverage figure, an archival date.

APA

Balamuta, J. J. (2026). R Observatory: Metrics for mockthat version 0.2.8 [Data set]. HJJB, LLC. Data release v2026-08-18. https://doi.org/10.5281/zenodo.21843040

From data release v2026-08-18, which the citation names so these numbers can be found later. More on citing and the projects behind them.

Report a problem with this page →

Privacy choices

These apply to this browser and are stored on this device only. Nothing about your choice is sent to us.

Read the privacy policy