What problem does it solve?
It eliminates the pain of setting up and maintaining a consistent local Ethereum test environment by giving each test its own isolated anvil state with reliable snapshot/revert handling.
Core Features & Use Cases
- Vitest-first lifecycle ownership: one vitest plugin line spawns an anvil process per worker and manages readiness, teardown, and isolation automatically.
- Per-test snapshot/revert isolation: runs each test against a clean EVM state by taking and reverting snapshots around tests (unless isolation is explicitly disabled).
- EVM RPC bindings and account helpers: exposes anvil RPC method bindings (snapshot/revert/mine/time travel) plus deterministic account derivation utilities for the spawned mnemonic.
Use case example: You’re building a dapp and want confidence that your create_reader / create_provider flow behaves correctly against a real EVM without writing custom global setup or manually cleaning state between tests.
Quick Start
Add the vitest plugin line to your vitest.config.ts and import anvil in your test file so your existing reader/provider calls run against a fresh, per-test isolated anvil instance.