mirror of
https://github.com/denoland/deno
synced 2024-10-30 01:56:42 +00: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();
|
||||
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,8 +248,10 @@ impl GlobPattern {
|
|||
}
|
||||
|
||||
pub fn new(pattern: &str) -> Result<Self, AnyError> {
|
||||
let pattern =
|
||||
glob::Pattern::new(&escape_brackets(pattern).replace('\\', "/"))
|
||||
let pattern = escape_brackets(pattern)
|
||||
.replace('\\', "/")
|
||||
.replace("/./", "/");
|
||||
let pattern = glob::Pattern::new(&pattern)
|
||||
.with_context(|| format!("Failed to expand glob: \"{}\"", pattern))?;
|
||||
Ok(Self(pattern))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue