mirror of
https://github.com/denoland/deno.git
synced 2025-03-04 01:44:26 -05:00
fix(config): regression - handle relative patterns with leading dot slash (#21922)
This is a hacky quick fix. We need to spend more time cleaning up this code and push more stuff down into deno_config. Closes #21916
This commit is contained in:
parent
0b9c06b632
commit
daed588557
6 changed files with 33 additions and 3 deletions
|
@ -663,3 +663,9 @@ fn conditionally_loads_type_graph() {
|
||||||
.run();
|
.run();
|
||||||
assert_not_contains!(output.combined_output(), "type_reference.d.ts");
|
assert_not_contains!(output.combined_output(), "type_reference.d.ts");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
itest!(test_include_relative_pattern_dot_slash {
|
||||||
|
args: "test",
|
||||||
|
output: "test/relative_pattern_dot_slash/output.out",
|
||||||
|
cwd: Some("test/relative_pattern_dot_slash"),
|
||||||
|
});
|
||||||
|
|
7
cli/tests/testdata/test/relative_pattern_dot_slash/deno.json
vendored
Normal file
7
cli/tests/testdata/test/relative_pattern_dot_slash/deno.json
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"test": {
|
||||||
|
"include": [
|
||||||
|
"./test/**/*.test.mjs"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
5
cli/tests/testdata/test/relative_pattern_dot_slash/output.out
vendored
Normal file
5
cli/tests/testdata/test/relative_pattern_dot_slash/output.out
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
running 1 test from ./test/add.test.mjs
|
||||||
|
should add ... ok ([WILDCARD])
|
||||||
|
|
||||||
|
ok | 1 passed | 0 failed ([WILDCARD])
|
||||||
|
|
3
cli/tests/testdata/test/relative_pattern_dot_slash/test/add.mjs
vendored
Normal file
3
cli/tests/testdata/test/relative_pattern_dot_slash/test/add.mjs
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
export function add(a, b) {
|
||||||
|
return a + b;
|
||||||
|
}
|
7
cli/tests/testdata/test/relative_pattern_dot_slash/test/add.test.mjs
vendored
Normal file
7
cli/tests/testdata/test/relative_pattern_dot_slash/test/add.test.mjs
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import { add } from "./add.mjs";
|
||||||
|
|
||||||
|
Deno.test("should add", () => {
|
||||||
|
if (add(1, 2) !== 3) {
|
||||||
|
throw new Error("FAIL");
|
||||||
|
}
|
||||||
|
});
|
|
@ -248,9 +248,11 @@ impl GlobPattern {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new(pattern: &str) -> Result<Self, AnyError> {
|
pub fn new(pattern: &str) -> Result<Self, AnyError> {
|
||||||
let pattern =
|
let pattern = escape_brackets(pattern)
|
||||||
glob::Pattern::new(&escape_brackets(pattern).replace('\\', "/"))
|
.replace('\\', "/")
|
||||||
.with_context(|| format!("Failed to expand glob: \"{}\"", pattern))?;
|
.replace("/./", "/");
|
||||||
|
let pattern = glob::Pattern::new(&pattern)
|
||||||
|
.with_context(|| format!("Failed to expand glob: \"{}\"", pattern))?;
|
||||||
Ok(Self(pattern))
|
Ok(Self(pattern))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue