diff options
author | nokazn <41154684+nokazn@users.noreply.github.com> | 2024-01-04 10:43:17 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-03 20:43:17 -0500 |
commit | a0b687235907ce91358677353c00f575548313b4 (patch) | |
tree | 5a91d08d997ac7226208f3a24211fef9ef1123ef /cli/tests | |
parent | 00970daea2245bf4af6b3ee21d0e522fec5638b8 (diff) |
fix(cli): respect `exclude` option for `deno check` command (#21779)
This PR fixes #21658.
- `check` subcommand sees `exclude` option in `deno.json`. When some
paths passed with `check` command listed in `exclude`, they are ignored.
- When some files are listed in `exclude` and imported indirectly among
module graph, they are checked.
Diffstat (limited to 'cli/tests')
7 files changed, 51 insertions, 0 deletions
diff --git a/cli/tests/integration/check_tests.rs b/cli/tests/integration/check_tests.rs index fb699072e..36b80149d 100644 --- a/cli/tests/integration/check_tests.rs +++ b/cli/tests/integration/check_tests.rs @@ -133,6 +133,34 @@ itest!(check_deno_unstable_from_config { output_str: Some(""), }); +itest!(check_with_exclude_option_by_dir { + args: + "check --quiet --config check/exclude_option/deno.exclude_dir.json check/exclude_option/ignored/index.ts", + output_str: Some(""), + exit_code: 0, +}); + +itest!(check_with_exclude_option_by_glob { + args: + "check --quiet --config check/exclude_option/deno.exclude_glob.json check/exclude_option/ignored/index.ts", + output_str: Some(""), + exit_code: 0, +}); + +itest!(check_without_exclude_option { + args: + "check --quiet --config check/exclude_option/deno.json check/exclude_option/ignored/index.ts", + output: "check/exclude_option/exclude_option.ts.error.out", + exit_code: 1, +}); + +itest!(check_imported_files_listed_in_exclude_option { + args: + "check --quiet --config check/exclude_option/deno.exclude_dir.json check/exclude_option/index.ts", + output: "check/exclude_option/exclude_option.ts.error.out", + exit_code: 1, +}); + #[test] fn cache_switching_config_then_no_config() { let context = TestContext::default(); diff --git a/cli/tests/testdata/check/exclude_option/deno.exclude_dir.json b/cli/tests/testdata/check/exclude_option/deno.exclude_dir.json new file mode 100644 index 000000000..2019f8953 --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/deno.exclude_dir.json @@ -0,0 +1,5 @@ +{ + "exclude": [ + "ignored" + ] +} diff --git a/cli/tests/testdata/check/exclude_option/deno.exclude_glob.json b/cli/tests/testdata/check/exclude_option/deno.exclude_glob.json new file mode 100644 index 000000000..1d203ba08 --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/deno.exclude_glob.json @@ -0,0 +1,5 @@ +{ + "exclude": [ + "ignored/**/*" + ] +} diff --git a/cli/tests/testdata/check/exclude_option/deno.json b/cli/tests/testdata/check/exclude_option/deno.json new file mode 100644 index 000000000..a9eca74ca --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/deno.json @@ -0,0 +1,3 @@ +{ + "exclude": [] +} diff --git a/cli/tests/testdata/check/exclude_option/exclude_option.ts.error.out b/cli/tests/testdata/check/exclude_option/exclude_option.ts.error.out new file mode 100644 index 000000000..abd1c1258 --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/exclude_option.ts.error.out @@ -0,0 +1,4 @@ +error: TS2304 [ERROR]: Cannot find name 'nothing'. +export { nothing }; + ~~~~~~~ + at [WILDCARD] diff --git a/cli/tests/testdata/check/exclude_option/ignored/index.ts b/cli/tests/testdata/check/exclude_option/ignored/index.ts new file mode 100644 index 000000000..0419cf073 --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/ignored/index.ts @@ -0,0 +1 @@ +export { nothing }; diff --git a/cli/tests/testdata/check/exclude_option/index.ts b/cli/tests/testdata/check/exclude_option/index.ts new file mode 100644 index 000000000..8335ca3a2 --- /dev/null +++ b/cli/tests/testdata/check/exclude_option/index.ts @@ -0,0 +1,5 @@ +import { nothing } from "./ignored/index.ts"; + +const foo = 1; + +export { foo, nothing }; |