Update cargo.rs to allow debugging of integration test annotated with the ignore attribute (#42574)

mikeHag created

Address #40429

If an integration test is annotated with the ignore attribute, allow the
"debug: Test" option of the debug scenario or Code Action to run with
"--include-ignored"

Closes #40429

Release Notes:

- N/A

Change summary

crates/project/src/debugger/locators/cargo.rs | 5 +++++
1 file changed, 5 insertions(+)

Detailed changes

crates/project/src/debugger/locators/cargo.rs 🔗

@@ -148,6 +148,8 @@ impl DapLocator for CargoLocator {
             .first()
             .is_some_and(|arg| arg == "test" || arg == "t");
 
+        let is_ignored = build_config.args.contains(&"--include-ignored".to_owned());
+
         let executables = output
             .lines()
             .filter(|line| !line.trim().is_empty())
@@ -205,6 +207,9 @@ impl DapLocator for CargoLocator {
         let mut args: Vec<_> = test_name.into_iter().collect();
         if is_test {
             args.push("--nocapture".to_owned());
+            if is_ignored {
+                args.push("--include-ignored".to_owned());
+            }
         }
 
         Ok(DebugRequest::Launch(task::LaunchRequest {