Skip to content

mockthat

0.2.8Package record

Function Mocking for Unit Testing

0packages dependsuggested by 4
10.6Kdownloads / year
90.3%test coverage
13/13flavors OK

Overview

About

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.

Changes in 0.2.8
  • Remove some tests: due to an internal change in jsonlite, this is no longer a useful example.

From NEWS.md in the release

Install

Health

CRAN checks
13OK
Slowest check: 49 s · r-devel-windows-x86_64
Status changes
  • OK13 OK2026-08-05
  • NOTE12 OK, 1 NOTE2026-08-01
  • OK14 OK2026-03-10
Advisories

none known

Documentation

In release 0.2.8
READMEYes · 389 wordsVignettesNoNEWSYes · 100% structured · mentions 0.2.8Citation fileNoWebsiteYes · pkgdown
Help pages
2
Examples that run
100%2 run in a plain check
Exported functions with examples
100%
Documented parameters
100%
Return-value docs
100%
Help pages citing references
0%

Downloads

10.6K
CRAN downloads in the past year
Rank #5,620 · ~29/day · ~887/mo
Daily download trend is not available in this view yet.
57330 days
1.5K90 days
10.6K1 year
Compare downloads with other packages →
Also on76 r2u3 autocran487 conda_forge

Repository

14Stars
1Forks
7Open issues
0Open PRs
0Releases
61Commits
2Commit identities
61 commits · Last activity 2022-10-31
Responsiveness
How these are sampled
PRs merged (all time)
100%
Median days to close, 50 most recently updated closed issues
9
Median days to close, 50 most recently updated closed PRs
64

Stars over time

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

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

Checks run against github.com/nbenn/mockthat on 2026-10-18.

Continuous integration (2)
GitHub ActionsR CMD check workflow

The R CMD check workflow runs on Linux, macOS and Windows, and on R-devel

Docs source (4)
README.Rmdpkgdown

GitHub Pages site last deployed 2022-10-31 · The repository has a site deploy workflow

Coverage (1)
Coverage reporting
CRAN release process (1)
cran-comments.md
How this is detected·Detection ruleset v3 (2026-09-26)

Dependencies

Declared dependencies
6 external dependencies (excludes base and recommended)

Installing mockthat adds 1 package (1 with compiled code, 766 KB of source tarballs). Heaviest: rlang 766 KB.

Depends (1)
R >= 3.3.0
Imports (2)
utilsrlang
LinkingTo (0)
none
Enhances (0)
none
Reverse dependencies
0direct
0indirect
Suggested by 4
Suggests, most downloaded first

People & History

People (1)
Author, Maintainer since 0.2.4 (2020)
Releases (3)

Pick two releases to compare their code metrics.

  • 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
  • unarchivedReturned to CRAN
    2022-11-01
  • 0.2.8Latest
    record
    2022-11-01 · current release · diff ↗
  • 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
    record
    2021-04-23 · diff ↗ ·
    added 1 export
    mock_arg
  • 0.2.4
    record
    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

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 package has no citation file, so citation() returns this entry built from DESCRIPTION.

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-10-22. https://doi.org/10.5281/zenodo.21843040

From data release v2026-10-22, 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