From 747d6a7c0bb873a63b03a834b488abac28ad65e0 Mon Sep 17 00:00:00 2001 From: ajwerner Date: Wed, 10 Jul 2024 16:13:06 -0500 Subject: [PATCH] cargo-insta: allow multiple --exclude flags (#520) Fixes #519 --- CHANGELOG.md | 2 ++ cargo-insta/src/cli.rs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1c6be9b..05d0457f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ All notable changes to insta and cargo-insta are documented here. - Mark `require-full-match` as experimental, given some corner-cases are currently difficult to manage. #497 +- `cargo insta test` now accepts multiple `--exclude` flags. #520 + ## 1.39.0 - Fixed a bug in `require_full_match`. #485 diff --git a/cargo-insta/src/cli.rs b/cargo-insta/src/cli.rs index db47ed09..23f2b203 100644 --- a/cargo-insta/src/cli.rs +++ b/cargo-insta/src/cli.rs @@ -137,7 +137,7 @@ struct TestCommand { package: Vec, /// Exclude packages from the test #[structopt(long, value_name = "SPEC")] - exclude: Option, + exclude: Vec, /// Disable force-passing of snapshot tests #[structopt(long)] no_force_pass: bool, @@ -866,7 +866,7 @@ fn prepare_test_runner<'snapshot_ref>( proc.arg("--package"); proc.arg(pkg); } - if let Some(ref spec) = cmd.exclude { + for spec in &cmd.exclude { proc.arg("--exclude"); proc.arg(spec); }