Skip to main content Link Menu Expand (external link) Document Search Copy Copied



Running local tests on your Anchor program with Sol Cerberus requires the following dependencies:

Create Make file to build the dependencies

Create the file ./Makefile on the root of your anchor program with the following content:

.PHONY: dependencies

	@if ! [ -d "deps/mpl-token-metadata" ]; then \
		echo "Adding submodule: Metaplex program library"; \
		git submodule add --force deps/mpl-token-metadata; \
	@if ! [ -d "deps/sol-cerberus" ]; then \
		echo "Adding submodule: Sol Cerberus"; \
		git submodule add --force deps/sol-cerberus; \
	@echo "installing npm packages"
	@echo "installing submodules"
	git submodule update --recursive --init
	@echo "Building token-metadata program.."
	cd deps/mpl-token-metadata/programs/token-metadata/program && cargo build-bpf && cd ../../../../
	@echo "Building sol-cerberus program.."
	cd deps/sol-cerberus/programs/sol-cerberus && cargo build-bpf && cd ../../../../

Run the Make file

Run make at the root folder of your Anchor program. This will clone and build the dependencies in the ./deps folder of your program.

Update Anchor.toml test dependencies

Open ./Anchor.toml and add the following lines at the bottom. This will load the Sol Cerberus and Metadata programs into your local environment when running tests:

address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
program = "./deps/mpl-token-metadata/programs/token-metadata/target/deploy/"

address = "SCERbrcgSPwgkrJ7j4TABr17dhYzdgiwPZUSSfFPt8x"
program = "./deps/sol-cerberus/target/deploy/"

Update package.json

Finally, add the corresponding javascript packages to facilitate testing.

    "devDependencies": {
        "sol-cerberus-js": "^0.1.7",
        "@metaplex-foundation/js": "^0.18.1",


Running tests

Run your tests normally with anchor test.

Table of contents