coral-xyz / anchor

⚓ Solana Sealevel Framework
https://anchor-lang.com
Apache License 2.0
3.68k stars 1.35k forks source link

cli: Upload program IDL to test-validator in `anchor test` #1844

Open charlieyou opened 2 years ago

charlieyou commented 2 years ago

I am testing an SDK locally with anchor test which inits the Program object using the .at() static method. This works fine on devnet and mainnet since I uploading the IDLs via anchor idl init, but fails locally since the IDL is not uploaded before the tests are run in anchor test.

charlieyou commented 2 years ago

Naively, create_idl_account() could be inserted here: https://github.com/project-serum/anchor/blob/282c394666a389ba9e086f974db39de7a6194028/cli/src/lib.rs#L1962

But I'm guessing it's better to do it at genesis instead of sending txs?