Skip to content

Commit dd83978

Browse files
committed
chore(vdev): add --features and --no-default-features flags to test command
1 parent a86f094 commit dd83978

1 file changed

Lines changed: 14 additions & 3 deletions

File tree

vdev/src/commands/test.rs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ pub struct Cli {
1717
/// Environment variables in the form KEY[=VALUE]
1818
#[arg(short, long)]
1919
env: Option<Vec<String>>,
20+
21+
/// Features to activate (comma-separated, or set FEATURES env var)
22+
#[arg(short = 'F', long, value_delimiter = ',', env = "FEATURES")]
23+
features: Vec<String>,
24+
25+
#[arg(long)]
26+
no_default_features: bool,
2027
}
2128

2229
fn parse_env(env: Vec<String>) -> BTreeMap<String, Option<String>> {
@@ -39,9 +46,13 @@ impl Cli {
3946
args.append(&mut extra_args);
4047
}
4148

42-
if !args.contains(&"--features".to_string()) {
43-
let features = platform::default_features();
44-
args.extend(["--features".to_string(), features.to_string()]);
49+
if self.no_default_features || !self.features.is_empty() {
50+
args.push("--no-default-features".to_string());
51+
if !self.features.is_empty() {
52+
args.extend(["--features".to_string(), self.features.join(",")]);
53+
}
54+
} else {
55+
args.extend(["--features".to_string(), platform::default_features().to_string()]);
4556
}
4657

4758
LocalTestRunner.test(

0 commit comments

Comments
 (0)