Introduction
A Foundry Anvil node in Docker per test file, with a viem test client already bound to it.
- Every anvil flag, validated as you set it.
- One client for everything: viem's test, public and wallet actions,
anvil extras and fluent
cheats. - Per-test isolation in milliseconds with snapshots.
New here? Start with the quick start.
Find your task
| I want to… | Go to |
|---|---|
| Start a node per test file and reset it between tests | Share a node, Isolate tests |
| Use, fund or impersonate accounts | Accounts and signing |
| Send transactions, assert reverts, simulate | Transactions and contracts |
| Move time, control mining and block contents | Time and blocks |
| Mock contracts, save or load state, boot from genesis | State and mocks |
| Test against mainnet state | Forking |
| React to events | Events |
| Configure the chain, EVM, RPC server, logs or client | Configure the node |
| Find out why something failed | Debug |
| Look up a method, flag or error | Reference |
| Understand how it works | Concepts |
How to read the samples
Every sample is a tested #region of
examples/,
linked under the sample.
anvil(ornode,fork…) is a started node, usually fromuseAnvil().expectanditare Jest's; any runner works.deployToken,mint,balanceOf,exampleToken,expectRevertandtriggerUntilare helpers fromexamples/src.