diff --git a/CHANGELOG.md b/CHANGELOG.md index ec4bdf4da3..101f184917 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ incremented for features. * ts: Add `program.simulate` namespace ([#266](https://github.com/project-serum/anchor/pull/266)). * cli: Add yarn flag to test command ([#267](https://github.com/project-serum/anchor/pull/267)). +* cli: Add `--skip-build` flag to test command ([301](https://github.com/project-serum/anchor/pull/301)). ## Breaking Changes diff --git a/cli/src/main.rs b/cli/src/main.rs index 367006b2d3..a4d22dd82f 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -76,6 +76,10 @@ pub enum Command { /// url is a localnet. #[clap(long)] skip_local_validator: bool, + /// Flag to skip building the program in the workspace, + /// use this to save time when running test and the program code is not altered. + #[clap(long)] + skip_build: bool, /// Use this flag if you want to use yarn as your package manager. #[clap(long)] yarn: bool, @@ -242,9 +246,10 @@ fn main() -> Result<()> { Command::Test { skip_deploy, skip_local_validator, + skip_build, yarn, file, - } => test(skip_deploy, skip_local_validator, yarn, file), + } => test(skip_deploy, skip_local_validator, skip_build, yarn, file), #[cfg(feature = "dev")] Command::Airdrop { url } => airdrop(url), Command::Cluster { subcmd } => cluster(subcmd), @@ -925,6 +930,7 @@ enum OutFile { fn test( skip_deploy: bool, skip_local_validator: bool, + skip_build: bool, use_yarn: bool, file: Option, ) -> Result<()> { @@ -932,7 +938,10 @@ fn test( // Bootup validator, if needed. let validator_handle = match cfg.cluster.url() { "http://127.0.0.1:8899" => { - build(None, false)?; + match skip_build { + true => None, + false => Some(build(None, false)?), + }; let flags = match skip_deploy { true => None, false => Some(genesis_flags(cfg)?),