Skip to content

Commit

Permalink
cli: Add --skip-build flag to anchor test (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
nutchanon-ust authored May 22, 2021
1 parent fb00331 commit 691a30a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
13 changes: 11 additions & 2 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -925,14 +930,18 @@ enum OutFile {
fn test(
skip_deploy: bool,
skip_local_validator: bool,
skip_build: bool,
use_yarn: bool,
file: Option<String>,
) -> Result<()> {
with_workspace(|cfg, _path, _cargo| {
// 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)?),
Expand Down

0 comments on commit 691a30a

Please sign in to comment.