This error came back in 2023 after the previous post here from 2022 August.
anchor run test1
now gave me Error: failed to get recent blockhash: TypeError: fetch failed
!!??
That is because it does not run a local network then deploy my programs... So that is new in Anchor 0.29.0
My Anchor.toml
[scripts]
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
test1 = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/zero-copy.ts"
anchor test -h
gave me --run <RUN> Run the test suites under the specified path
When I ran anchor test --run ./tests/zero-copy.ts
, Anchor still ran all tests!!??
Workaround: change the Anchor.toml test path:
test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/zero-copy.ts"
But this is a workaround, not the best solution...
How can I add multiple tests in [script]
then run one of the tests?