Practical overview
When it fits
Use PRBTest when Solidity tests need reusable, typed assertions or logging, particularly in a Foundry project; the project also documents Hardhat use.
Who it is for
- Solidity developers building smart-contract test suites.
- Foundry users who want reusable assertions and logging in test contracts.
- Hardhat users seeking Solidity testing assertions.
Documented uses
- Assert equality, inequality, approximate equality, numeric comparisons, boolean conditions and collection membership in Solidity tests.
- Provide custom error messages for assertions.
- Emit logs and access a pre-instantiated Foundry cheatcode environment from an inheriting test contract.
Requirements & limits
- Designed for Solidity 0.8.0 and later.
- Foundry is the intended environment, while the README also says it can be used with Hardhat.
- The README recommends Node.js package-manager installation and documents Foundry remapping configuration.
- PRBTest can be combined with Forge Std utilities except for its
Testcontract. - The repository identifies the license as MIT.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install PRBTest with a Node.js package manager for Foundry
Add PRBTest to a project and configure Foundry to resolve its package import.
Before you start
- A Node.js package manager.
- A Foundry project if using the documented Foundry remapping.
Steps
Install the package with a package manager; the README gives
bun add @prb/testas an example.For Foundry, add
@prb/test/=node_modules/@prb/test/src/toremappings.txt.
Expected outcome
The package and Foundry remapping are configured as described in the README.
Guide limitations
- The README also documents a Git submodule method but says it is not recommended.
- This covers installation and import resolution, not running or validating a test suite.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 12 October 2026
- Original website title
- PaulRBerg/prb-test · Official homepage title · retained in its source language
Related options
DSTest — PRBTest describes itself as a replacement for DSTest and cites added assertions, including array equality and inequality checks.
Forge Std — PRBTest is complementary to Forge Std testing utilities, except for Forge Std's Test contract.

