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

981

Last 30 days

3844th

3.1K

Last 90 days

13K

Last year

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

CRAN Check Status

14 OK
Show all 14 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-macos-arm64 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 (5)

Dependency Network

Dependencies Reverse dependencies rlang SeaSondeR dynamite geohabnet rcldf ricu mockthat

Version History

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