cli: Add support for multiple commands with `anchor test` (#2799)

This commit is contained in:
Aoi Kurokawa 2024-02-01 22:59:46 +09:00 committed by GitHub
parent 616dd239c3
commit 94fde24339
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 8 deletions

View File

@ -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

View File

@ -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)