#solana #extension #testing #environments #compatible #anchor #pubkey

test_utils_solana

Utilities and extensions for testing solana in wasm compatible environments

19 releases (4 breaking)

0.5.5 Nov 4, 2024
0.5.4 Oct 20, 2024
0.4.7 Oct 9, 2024
0.4.0 Sep 28, 2024
0.1.1 Sep 13, 2024

#747 in Magic Beans

Download history 265/week @ 2024-09-09 365/week @ 2024-09-16 173/week @ 2024-09-23 429/week @ 2024-09-30 1165/week @ 2024-10-07 407/week @ 2024-10-14 72/week @ 2024-10-21 3/week @ 2024-10-28 141/week @ 2024-11-04

801 downloads per month

Unlicense

1MB
26K SLoC

test_utils_solana


Utilities and extensions for testing solana in wasm compatible environments.


Crate Docs Status Unlicense codecov

Installation

To install you can used the following command:

cargo add --dev test_utils_solana

Or directly add the following to your Cargo.toml:

[dev-dependencies]
test_utils_solana = "0.1" # replace with the latest version

Features

Feature Description
test_validator Enables the test_validator feature for the solana_test_validator crate.
ssr Enables the ssr feature for the test_utils crate.
js Enables the js feature for the test_utils crate.

Usage

The following requires the test_validator feature to be enabled.

use solana_sdk::pubkey;
use test_utils_solana::TestValidatorRunner;
use test_utils_solana::TestValidatorRunnerProps;

async fn run() -> TestValidatorRunner {
	let pubkey = pubkey!("99P8ZgtJYe1buSK8JXkvpLh8xPsCFuLYhz9hQFNw93WJ");
	let props = TestValidatorRunnerProps::builder()
		.pubkeys(vec![pubkey]) // pubkeys to fund with an amount of sol each
		.initial_lamports(1_000_000_000) // initial lamports to add to each pubkey account
		.namespace("tests") // namespace to use for the validator client rpc
		.build();

	TestValidatorRunner::run(props).await
}

Dependencies

~145MB
~3M SLoC