1

The official Solana documentation on testing a Program via an Anchor project says:

If you prefer Rust for testing, initialize your project with the --test-template rust flag.
anchor init --test-template rust my-program

However, the official Anchor documentation doesn't say anything about the --test-template flag of anchor init, nor is it accepted when you try to run the anchor init --test-template rust my-program command in CLI, with anchor-cli 0.28.0 installed.

The only note regarding the matter that I could find in the Anchor docs is the following:

Note: The Anchor workflow recommends to test your program using integration tests in a language other than Rust to make sure that bugs related to syntax misunderstandings are coverable with tests and not just replicated in tests.

How can Anchor be configured to accept tests written in Rust (and not TypeScript)?

1 Answer 1

2

This might be an issue with the version of anchor you are using.

To initialize a new project with version anchor-cli 0.30.1 using Rust for the tests

anchor init --test-template rust PROJECT_NAME

To change anchor version, use AVM

avm install latest # not needed if you have it installed

avm use latest
1
  • 1
    That was it, thank you for the hint, @Jimii!
    – Iaroslav
    Commented Oct 14 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.