1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -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:
David Sherret 2024-01-13 10:39:22 -05:00 committed by GitHub
parent 0b9c06b632
commit daed588557
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 33 additions and 3 deletions

View file

@ -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"),
});

View file

@ -0,0 +1,7 @@
{
"test": {
"include": [
"./test/**/*.test.mjs"
]
}
}

View file

@ -0,0 +1,5 @@
running 1 test from ./test/add.test.mjs
should add ... ok ([WILDCARD])
ok | 1 passed | 0 failed ([WILDCARD])

View file

@ -0,0 +1,3 @@
export function add(a, b) {
return a + b;
}

View file

@ -0,0 +1,7 @@
import { add } from "./add.mjs";
Deno.test("should add", () => {
if (add(1, 2) !== 3) {
throw new Error("FAIL");
}
});

View file

@ -248,9 +248,11 @@ impl GlobPattern {
}
pub fn new(pattern: &str) -> Result<Self, AnyError> {
let pattern =
glob::Pattern::new(&escape_brackets(pattern).replace('\\', "/"))
.with_context(|| format!("Failed to expand glob: \"{}\"", pattern))?;
let pattern = escape_brackets(pattern)
.replace('\\', "/")
.replace("/./", "/");
let pattern = glob::Pattern::new(&pattern)
.with_context(|| format!("Failed to expand glob: \"{}\"", pattern))?;
Ok(Self(pattern))
}