diff --git a/packages/nx/src/native/utils/glob.rs b/packages/nx/src/native/utils/glob.rs index 93c37883cdd65..cb6edcf48bae5 100644 --- a/packages/nx/src/native/utils/glob.rs +++ b/packages/nx/src/native/utils/glob.rs @@ -128,7 +128,7 @@ fn convert_glob(glob: &str) -> anyhow::Result> { globs.push(format!( "!{}", SINGLE_PATTERN_REGEX - .replace(&glob, |caps: ®ex::Captures| { caps[1].to_string() }) + .replace(&glob, |caps: ®ex::Captures| { format!("{}*", &caps[1]) }) .replace('!', "") )); } else { @@ -197,7 +197,7 @@ mod test { #[test] fn convert_globs_single_negative() { let negative_single_dir = convert_glob("packages/!(package-a)*").unwrap(); - assert_eq!(negative_single_dir, ["packages/*", "!packages/package-a"]); + assert_eq!(negative_single_dir, ["packages/*", "!packages/package-a*"]); } #[test] @@ -318,6 +318,8 @@ mod test { assert!(glob_set.is_match("packages/package-c")); // no matches assert!(!glob_set.is_match("packages/package-a")); + assert!(!glob_set.is_match("packages/package-a-b")); + assert!(!glob_set.is_match("packages/package-a-b/nested")); assert!(!glob_set.is_match("packages/package-b/nested")); } }