JavaScript library for spinning up a local Solana test validator instance programmatically, intended for use with test frameworks like Mocha. Version 1.0.2 provides a startAndConnect function that spawns a solana-test-validator process, creates a Connection instance, and optionally funds accounts. It also exports getAccounts for generating Keypairs and a Cleanup type. Requires the Solana CLI tool suite to be installed. Differentiators: simplifies test setup compared to manual CLI spawning, supports TypeScript directly, and integrates cleanly with Mocha global fixtures. Release cadence: infrequent (last update 2023).
npm install solana-test-validator-jsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Launch a local Solana test validator with one funded account, obtain a Connection, and clean up after tests.
Install Solana CLI tools: sh -c "$(curl -sSfL https://release.solana.com/stable/install)"
Use a mainnet or devnet connection for production code.
Always call startAndConnect before accessing the connection singleton. Alternatively, use the returned connection from startAndConnect.
Add test-ledger/ to .gitignore and manually delete the folder between test runs.
Set mocha timeout to at least 60000ms: this.timeout(60000);
Run: npm install -D solana-test-validator-js
Use import { startAndConnect } from 'solana-test-validator-js' and ensure your project uses ESM (type: module in package.json or .mjs extension).Install Solana CLI tools and ensure solana-test-validator is accessible in your terminal.
Ensure startAndConnect returns a tuple: [connection, cleanup]. Check that solana-test-validator process started successfully.