Skip to content

mockthat

Function Mocking for Unit Testing

v0.2.8 · Nov 1, 2022 · MIT + file LICENSE

Description

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.

Downloads

CRAN

773

Last 30 days

4123rd

2.5K

Last 90 days

12.5K

Last year

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

r2u CRAN

14

Last 30 days

31

Last 90 days

106

Last year

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

autoCRAN

3

Last 7 days

6

Last 30 days

0

All-time

autoCRAN-only: this name is served only by autoCRAN, so the count is exact.

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

Reverse Dependencies (4)

Dependency Network

Dependencies Reverse dependencies rlang SeaSondeR dynamite geohabnet ricu mockthat

Version History

4 tracked
new 0.2.8 Mar 10, 2026
updated 0.2.8 ← 0.2.6 diff Oct 31, 2022
updated 0.2.6 ← 0.2.4 diff Apr 22, 2021
new 0.2.4 Dec 8, 2020