Skip to content

Commit

Permalink
cli: Add support for multiple commands with anchor test (#2799)
Browse files Browse the repository at this point in the history
  • Loading branch information
aoikurokawa authored Feb 1, 2024
1 parent 616dd23 commit 94fde24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- ts: Add IdlSeed Type for IDL PDA seeds ([#2752](https://github.com/coral-xyz/anchor/pull/2752)).
- cli: `idl close` accepts optional `--idl-address` parameter ([#2760](https://github.com/coral-xyz/anchor/pull/2760)).
- cli: Add support for simple wildcard patterns in Anchor.toml's `workspace.members` and `workspace.exclude`. ([#2785](https://github.com/coral-xyz/anchor/pull/2785)).
- cli: `anchor test` is able to run multiple commands ([#2799](https://github.com/coral-xyz/anchor/pull/2799)).

### Fixes

Expand Down
12 changes: 4 additions & 8 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3201,14 +3201,10 @@ fn run_test_suite(
.get("test")
.expect("Not able to find script for `test`")
.clone();
let mut args: Vec<&str> = cmd
.split(' ')
.chain(extra_args.iter().map(|arg| arg.as_str()))
.collect();
let program = args.remove(0);

std::process::Command::new(program)
.args(args)
let script_args = format!("{cmd} {}", extra_args.join(" "));
std::process::Command::new("bash")
.arg("-c")
.arg(script_args)
.env("ANCHOR_PROVIDER_URL", url)
.env("ANCHOR_WALLET", cfg.provider.wallet.to_string())
.env("NODE_OPTIONS", node_options)
Expand Down

0 comments on commit 94fde24

Please sign in to comment.