Skip to content

Commit f8dbbc2

Browse files
docs: recommend single command 'anchor test' for Anchor examples; clean legacy references
- Standardize Anchor testing instructions on one command: `anchor test`. - Remove alternative `cargo test` suggestions from CONTRIBUTING.md and Anchor READMEs (counter, hello-solana, close-account, transfer-sol, rent, realloc, token-swap, transfer-tokens, create-token, program-derived-addresses, etc.). - Update root README framework description and getting-started text for consistency. - Remove ACTIVE-AUDIT-ITEMS.md from this PR (per request). - Preserve contributor credits in Pinocchio examples (e.g. @MarkFeder ports from solana-developers/program-examples) while cleaning other stale references. Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent bfc2df5 commit f8dbbc2

15 files changed

Lines changed: 35 additions & 31 deletions

File tree

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ See [CHANGELOG.md](./CHANGELOG.md) for release history. This file had no changel
1313

1414
- Each example lives at `category/example-name/<framework>/`, e.g. `basics/counter/anchor/`.
1515
- Supported frameworks: `anchor`, `quasar`, `pinocchio`, `native`, `asm`. Use the existing layout as a reference.
16-
- Anchor and Quasar programs usually keep Rust tests under `programs/<name>/tests/`.
16+
- Anchor programs keep Rust tests under `programs/<name>/tests/`.
17+
- Quasar programs keep tests in `src/tests.rs` (inside the single program crate) and run with `cargo test tests::` (per `[testing.rust.test]` in `Quasar.toml`) or `quasar test`.
1718
- Native and Pinocchio tests are Rust + LiteSVM, kept under `program/tests/`.
1819

1920
## Tooling
@@ -50,7 +51,7 @@ npx tsx --test --test-reporter=spec tests/*.ts
5051

5152
## Documentation
5253

53-
Every `anchor/` (and other framework) directory should include a `README.md`. Use [docs/example-readme-template.md](./docs/example-readme-template.md) as the starting point.
54+
Every `anchor/` (and other framework) directory should include a `README.md`. Use a complete, up-to-date example such as `basics/counter/anchor/README.md` or `finance/escrow/anchor/README.md` as a model.
5455

5556
Also update [CHANGELOG.md](./CHANGELOG.md) when you ship user-visible changes.
5657

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ Each example is available in one or more of the following frameworks:
2121
2222
## Getting started
2323

24-
You need [Rust](https://www.rust-lang.org/tools/install), [Solana CLI](https://docs.anza.xyz/cli/install), [Anchor](https://www.anchor-lang.com/docs/installation), and [pnpm](https://pnpm.io/installation) installed. Clone the repo and `cd` into any example directory, then run its tests with the command for that framework (shown above) - for an Anchor example, `anchor test`. `pnpm` is used for repo-wide formatting and linting, not for running an example's tests.
24+
You need [Rust](https://www.rust-lang.org/tools/install), [Solana CLI](https://docs.anza.xyz/cli/install), [Anchor](https://www.anchor-lang.com/docs/installation), and [pnpm](https://pnpm.io/installation) installed. Clone the repo and `cd` into any example directory, then run its tests with the command for that framework (shown above) for an Anchor example, `anchor test`. `pnpm` is used for repo-wide formatting and linting, not for running an example's tests.
2525

26-
To deploy to mainnet or devnet you'll need an RPC endpoint. [Quicknode](https://www.quicknode.com/chains/solana) provides free and paid Solana endpoints - create one and set it as your cluster in `Anchor.toml` or with `solana config set --url <your-endpoint>`.
26+
To deploy to mainnet or devnet you'll need an RPC endpoint. [Quicknode](https://www.quicknode.com/chains/solana) provides free and paid Solana endpoints create one and set it as your cluster in `Anchor.toml` or with `solana config set --url <your-endpoint>`.
2727

2828
## Financial software ("DeFi")
2929

basics/close-account/anchor/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@ Two [instruction handlers](https://solana.com/docs/terminology#instruction-handl
3434
## Setup
3535

3636
```bash
37-
pnpm install
3837
anchor build
3938
```
4039

40+
Prerequisites: the [Agave](https://docs.anza.xyz/) toolchain and the [Anchor](https://www.anchor-lang.com/docs) CLI.
41+
4142
## Testing
4243

4344
Tests live in [`programs/close-account/tests/test_close_account.rs`](programs/close-account/tests/test_close_account.rs) and run in-process with LiteSVM:
4445

4546
```bash
46-
pnpm test
47+
anchor test
4748
```
49+
50+
(`anchor test` runs the command configured in `Anchor.toml` `[scripts] test`.)

basics/counter/anchor/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,20 @@ See also: the [repository catalog](../../README.md).
1515
From `basics/counter/anchor/`:
1616

1717
```bash
18-
pnpm install
1918
anchor build
2019
```
2120

21+
Prerequisites: the [Agave](https://docs.anza.xyz/) toolchain and the [Anchor](https://www.anchor-lang.com/docs) CLI.
22+
2223
## Testing
2324

25+
LiteSVM integration tests in `programs/counter_anchor/tests/` call handlers and assert the stored count.
26+
2427
```bash
25-
pnpm test
28+
anchor test
2629
```
2730

28-
LiteSVM integration tests in `programs/counter_anchor/tests/` call handlers and assert the stored count.
31+
(`anchor test` runs the command configured in `Anchor.toml` `[scripts] test`.)
2932

3033
## Usage
3134

basics/favorites/anchor/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ LiteSVM tests in `programs/` assert that users cannot overwrite each other's sta
2626

2727
## Usage
2828

29-
`anchor deploy` targets the cluster in `Anchor.toml`. Used in [Solana Professional Education](https://github.com/solana-developers/professional-education).
29+
`anchor deploy` targets the cluster in `Anchor.toml`.

basics/hello-solana/anchor/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,20 @@ See also: [Hello Solana overview](../README.md) and the [repository catalog](../
1414
From this directory (`basics/hello-solana/anchor/`):
1515

1616
```bash
17-
pnpm install
1817
anchor build
1918
```
2019

21-
Prerequisites: [Agave](https://docs.anza.xyz/) CLI (version in `Anchor.toml` `[toolchain]`), [Anchor](https://www.anchor-lang.com/docs), and `pnpm`.
20+
Prerequisites: the [Agave](https://docs.anza.xyz/) toolchain and the [Anchor](https://www.anchor-lang.com/docs) CLI.
2221

2322
## Testing
2423

2524
Tests run in-process with [LiteSVM](https://www.anchor-lang.com/docs/testing/litesvm). No local validator.
2625

2726
```bash
28-
pnpm test
27+
anchor test
2928
```
3029

31-
This runs `cargo test` as configured in `Anchor.toml`. Tests call instruction handlers and check onchain state.
30+
(`anchor test` runs the command configured in `Anchor.toml` `[scripts] test`.) Tests call instruction handlers and check onchain state.
3231

3332
## Usage
3433

basics/program-derived-addresses/anchor/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Prerequisites: [Agave](https://docs.anza.xyz/) CLI (version in `Anchor.toml` `[t
2525
Tests run in-process with [LiteSVM](https://www.anchor-lang.com/docs/testing/litesvm). No local validator.
2626

2727
```bash
28-
pnpm test
28+
anchor test
2929
```
3030

31-
This runs `cargo test` as configured in `Anchor.toml`. Tests call instruction handlers and check onchain state.
31+
(`anchor test` runs the command configured in `Anchor.toml` `[scripts] test`.) Tests call instruction handlers and check onchain state.
3232

3333
## Usage
3434

basics/realloc/anchor/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Prerequisites: [Agave](https://docs.anza.xyz/) CLI (version in `Anchor.toml` `[t
2525
Tests run in-process with [LiteSVM](https://www.anchor-lang.com/docs/testing/litesvm). No local validator.
2626

2727
```bash
28-
pnpm test
28+
anchor test
2929
```
3030

31-
This runs `cargo test` as configured in `Anchor.toml`. Tests call instruction handlers and check onchain state.
31+
(`anchor test` runs the command configured in `Anchor.toml` `[scripts] test`.) Tests call instruction handlers and check onchain state.
3232

3333
## Usage
3434

basics/rent/anchor/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Prerequisites: [Agave](https://docs.anza.xyz/) CLI (version in `Anchor.toml` `[t
2525
Tests run in-process with [LiteSVM](https://www.anchor-lang.com/docs/testing/litesvm). No local validator.
2626

2727
```bash
28-
pnpm test
28+
anchor test
2929
```
3030

31-
This runs `cargo test` as configured in `Anchor.toml`. Tests call instruction handlers and check onchain state.
31+
(`anchor test` runs the command configured in `Anchor.toml` `[scripts] test`.) Tests call instruction handlers and check onchain state.
3232

3333
## Usage
3434

basics/transfer-sol/anchor/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Prerequisites: [Agave](https://docs.anza.xyz/) CLI (version in `Anchor.toml` `[t
2525
Tests run in-process with [LiteSVM](https://www.anchor-lang.com/docs/testing/litesvm). No local validator.
2626

2727
```bash
28-
pnpm test
28+
anchor test
2929
```
3030

31-
This runs `cargo test` as configured in `Anchor.toml`. Tests call instruction handlers and check onchain state.
31+
(`anchor test` runs the command configured in `Anchor.toml` `[scripts] test`.) Tests call instruction handlers and check onchain state.
3232

3333
## Usage
3434

0 commit comments

Comments
 (0)