mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
fix: better error message for malformed glob (#19225)
Before: ``` $ cargo run -- test "foo/*******/bar.ts" error: Pattern syntax error near position 6: wildcards are either regular `*` or recursive `**` ``` After: ``` $ cargo run -- test "foo/*******/bar.ts" error: Failed to expand glob: "foo/*******/bar.ts" Caused by: Pattern syntax error near position 6: wildcards are either regular `*` or recursive `**` ``` --------- Co-authored-by: David Sherret <dsherret@users.noreply.github.com>
This commit is contained in:
parent
8608105208
commit
3d865949c2
1 changed files with 12 additions and 1 deletions
|
@ -1343,7 +1343,8 @@ fn expand_globs(paths: &[PathBuf]) -> Result<Vec<PathBuf>, AnyError> {
|
|||
// true because it copies with sh does—these files are considered "hidden"
|
||||
require_literal_leading_dot: true,
|
||||
},
|
||||
)?;
|
||||
)
|
||||
.with_context(|| format!("Failed to expand glob: \"{}\"", path_str))?;
|
||||
|
||||
for globbed_path_result in globbed_paths {
|
||||
new_paths.push(globbed_path_result?);
|
||||
|
@ -1592,6 +1593,16 @@ mod test {
|
|||
|
||||
temp_dir.write("pages/[id].ts", "");
|
||||
|
||||
let error = resolve_files(
|
||||
Some(FilesConfig {
|
||||
include: vec![temp_dir.path().join("data/**********.ts")],
|
||||
exclude: vec![],
|
||||
}),
|
||||
None,
|
||||
)
|
||||
.unwrap_err();
|
||||
assert!(error.to_string().starts_with("Failed to expand glob"));
|
||||
|
||||
let resolved_files = resolve_files(
|
||||
Some(FilesConfig {
|
||||
include: vec![
|
||||
|
|
Loading…
Reference in a new issue