Overview
The Foundry Anvil Testcontainers NodeJS Module brings enterprise-grade test automation to Web3 development. This powerful module provides seamless integration between Testcontainers and Foundry’s Anvil local Ethereum node, enabling developers to run isolated, reproducible integration tests for smart contracts and decentralized applications.
Key Features
- Zero Configuration Setup - Spin up isolated Anvil instances with a single line of code
- Full Testcontainers Integration - Leverages the battle-tested Testcontainers framework
- Parallel Test Execution - Run multiple test suites simultaneously with isolated blockchain states
- CI/CD Ready - Works seamlessly in GitHub Actions, GitLab CI, and other automation pipelines
- TypeScript Support - Fully typed for enhanced developer experience
- Custom Network Configuration - Configure block time, chain ID, and other network parameters
- Snapshot & Forking Support - Test against mainnet forks or custom blockchain snapshots
Why This Matters
In the rapidly evolving Web3 ecosystem, quality and security are non-negotiable. Smart contract bugs can lead to millions in losses. Our Foundry Anvil Testcontainers module reflects our commitment to building tools that:
- Eliminate Environment Drift - Every test runs in a pristine, identical environment
- Accelerate Development Cycles - Developers spend less time on test setup and more time building
- Improve Test Reliability - Consistent, reproducible tests mean fewer false positives
- Enable Continuous Testing - Seamless CI/CD integration ensures quality at every commit
Installation
npm install @hellaweb3/foundryanvil-testcontainers-nodejs
or
yarn add @hellaweb3/foundryanvil-testcontainers-nodejs
Quick Start
import { FoundryAnvilContainer } from '@hellaweb3/foundryanvil-testcontainers-nodejs';
// Start an Anvil container
const container = await new FoundryAnvilContainer().start();
// Get the RPC endpoint
const rpcUrl = container.getRpcUrl();
// Use with your favorite Web3 library
const provider = new ethers.JsonRpcProvider(rpcUrl);
// Run your tests...
// Cleanup
await container.stop();
Technical Excellence
This project showcases our engineering philosophy:
- Comprehensive Test Coverage - Dogfooding our own tools to ensure reliability
- Modern TypeScript Architecture - Type-safe, maintainable, and extensible
- Performance Optimized - Fast container startup and minimal resource overhead
- Extensive Documentation - Clear examples and API references
- Active Maintenance - Regular updates to support the latest Foundry releases
Real-World Impact
Development teams using this module report:
- 80% reduction in test environment setup time
- Near-zero flaky tests due to environment inconsistencies
- Seamless onboarding for new developers joining Web3 projects
Resources
- GitHub Repository: hella-web3/foundryanvil-testcontainers-nodejs
- NPM Package: @hellaweb3/foundryanvil-testcontainers-nodejs
- Documentation: Full API Documentation
Ship with confidence.
Our automation strategies reduce your time-to-market while increasing the reliability of your protocol. This open-source project is just a glimpse of what we can deliver for your team.
Get a DevOps AuditPart of the Hella Labs commitment to open-source excellence and Web3 infrastructure.