diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs index 5150aeb92d..97aba80516 100644 --- a/cli/tests/integration/test_tests.rs +++ b/cli/tests/integration/test_tests.rs @@ -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"), +}); diff --git a/cli/tests/testdata/test/relative_pattern_dot_slash/deno.json b/cli/tests/testdata/test/relative_pattern_dot_slash/deno.json new file mode 100644 index 0000000000..7c2c4a5d31 --- /dev/null +++ b/cli/tests/testdata/test/relative_pattern_dot_slash/deno.json @@ -0,0 +1,7 @@ +{ + "test": { + "include": [ + "./test/**/*.test.mjs" + ] + } +} diff --git a/cli/tests/testdata/test/relative_pattern_dot_slash/output.out b/cli/tests/testdata/test/relative_pattern_dot_slash/output.out new file mode 100644 index 0000000000..be2961cff9 --- /dev/null +++ b/cli/tests/testdata/test/relative_pattern_dot_slash/output.out @@ -0,0 +1,5 @@ +running 1 test from ./test/add.test.mjs +should add ... ok ([WILDCARD]) + +ok | 1 passed | 0 failed ([WILDCARD]) + diff --git a/cli/tests/testdata/test/relative_pattern_dot_slash/test/add.mjs b/cli/tests/testdata/test/relative_pattern_dot_slash/test/add.mjs new file mode 100644 index 0000000000..7d658310b0 --- /dev/null +++ b/cli/tests/testdata/test/relative_pattern_dot_slash/test/add.mjs @@ -0,0 +1,3 @@ +export function add(a, b) { + return a + b; +} diff --git a/cli/tests/testdata/test/relative_pattern_dot_slash/test/add.test.mjs b/cli/tests/testdata/test/relative_pattern_dot_slash/test/add.test.mjs new file mode 100644 index 0000000000..7b21d2fbc1 --- /dev/null +++ b/cli/tests/testdata/test/relative_pattern_dot_slash/test/add.test.mjs @@ -0,0 +1,7 @@ +import { add } from "./add.mjs"; + +Deno.test("should add", () => { + if (add(1, 2) !== 3) { + throw new Error("FAIL"); + } +}); diff --git a/cli/util/glob.rs b/cli/util/glob.rs index 7bd600167a..4fe8a9a0ac 100644 --- a/cli/util/glob.rs +++ b/cli/util/glob.rs @@ -248,9 +248,11 @@ impl GlobPattern { } pub fn new(pattern: &str) -> Result { - 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)) }