summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
authorscarf <greenscarf005@gmail.com>2023-04-27 12:02:36 +0900
committerGitHub <noreply@github.com>2023-04-26 23:02:36 -0400
commit90a5ef5e343bedc0f6f5326b14b6851b71733bea (patch)
tree4c53261235e3d8720cad99341ee1eac31a92fa3e /cli/tests
parent4192978c3afc943b93d9fae0f65822a2c4edfa62 (diff)
feat(cli): flatten deno.json configuaration (#17799)
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/fmt_tests.rs6
-rw-r--r--cli/tests/integration/test_tests.rs6
-rw-r--r--cli/tests/testdata/bench/collect/deno.jsonc8
-rw-r--r--cli/tests/testdata/bench/collect/deno.malformed.jsonc6
-rw-r--r--cli/tests/testdata/bench/collect/deno2.jsonc10
-rw-r--r--cli/tests/testdata/bench/collect_with_malformed_config.out2
-rw-r--r--cli/tests/testdata/fmt/deno.malformed.jsonc6
-rw-r--r--cli/tests/testdata/fmt/deno.malformed2.jsonc8
-rw-r--r--cli/tests/testdata/fmt/fmt_with_deprecated_config.out3
-rw-r--r--cli/tests/testdata/fmt/fmt_with_malformed_config.out2
-rw-r--r--cli/tests/testdata/fmt/fmt_with_malformed_config2.out2
-rw-r--r--cli/tests/testdata/fmt/with_config/deno.deprecated.jsonc20
-rw-r--r--cli/tests/testdata/fmt/with_config/deno.jsonc28
-rw-r--r--cli/tests/testdata/lint/Deno.compact.format.jsonc6
-rw-r--r--cli/tests/testdata/lint/Deno.jsonc6
-rw-r--r--cli/tests/testdata/lint/Deno.malformed.jsonc6
-rw-r--r--cli/tests/testdata/lint/Deno.malformed2.jsonc8
-rw-r--r--cli/tests/testdata/lint/Deno.no_tags.jsonc14
-rw-r--r--cli/tests/testdata/lint/with_malformed_config.out2
-rw-r--r--cli/tests/testdata/lint/with_malformed_config2.out2
-rw-r--r--cli/tests/testdata/lsp/deno.lint.exclude.jsonc8
-rw-r--r--cli/tests/testdata/test/collect.deprecated.out10
-rw-r--r--cli/tests/testdata/test/collect/deno.deprecated.jsonc7
-rw-r--r--cli/tests/testdata/test/collect/deno.jsonc4
-rw-r--r--cli/tests/testdata/test/collect/deno2.jsonc6
-rw-r--r--cli/tests/testdata/test/collect_with_malformed_config.out2
26 files changed, 106 insertions, 82 deletions
diff --git a/cli/tests/integration/fmt_tests.rs b/cli/tests/integration/fmt_tests.rs
index 7812175a7..e47311cf0 100644
--- a/cli/tests/integration/fmt_tests.rs
+++ b/cli/tests/integration/fmt_tests.rs
@@ -229,6 +229,12 @@ itest!(fmt_with_config {
output: "fmt/fmt_with_config.out",
});
+itest!(fmt_with_deprecated_config {
+ args:
+ "fmt --config fmt/with_config/deno.deprecated.jsonc fmt/with_config/subdir",
+ output: "fmt/fmt_with_deprecated_config.out",
+});
+
itest!(fmt_with_config_default {
args: "fmt fmt/with_config/subdir",
output: "fmt/fmt_with_config.out",
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs
index cf1665289..0e1a39deb 100644
--- a/cli/tests/integration/test_tests.rs
+++ b/cli/tests/integration/test_tests.rs
@@ -77,6 +77,12 @@ itest!(test_with_config2 {
output: "test/collect2.out",
});
+itest!(test_with_deprecated_config {
+ args: "test --config test/collect/deno.deprecated.jsonc test/collect",
+ exit_code: 0,
+ output: "test/collect.deprecated.out",
+});
+
itest!(test_with_malformed_config {
args: "test --config test/collect/deno.malformed.jsonc",
exit_code: 1,
diff --git a/cli/tests/testdata/bench/collect/deno.jsonc b/cli/tests/testdata/bench/collect/deno.jsonc
index f88d13778..7f8f190d3 100644
--- a/cli/tests/testdata/bench/collect/deno.jsonc
+++ b/cli/tests/testdata/bench/collect/deno.jsonc
@@ -1,7 +1,5 @@
{
- "bench": {
- "files": {
- "exclude": ["./ignore"]
- }
- }
+ "bench": {
+ "exclude": ["./ignore"]
+ }
}
diff --git a/cli/tests/testdata/bench/collect/deno.malformed.jsonc b/cli/tests/testdata/bench/collect/deno.malformed.jsonc
index 02744bc11..8e558fbcf 100644
--- a/cli/tests/testdata/bench/collect/deno.malformed.jsonc
+++ b/cli/tests/testdata/bench/collect/deno.malformed.jsonc
@@ -1,5 +1,5 @@
{
- "bench": {
- "dont_know_this_field": {}
- }
+ "bench": {
+ "dont_know_this_field": {}
+ }
}
diff --git a/cli/tests/testdata/bench/collect/deno2.jsonc b/cli/tests/testdata/bench/collect/deno2.jsonc
index f24da5049..653ab1e31 100644
--- a/cli/tests/testdata/bench/collect/deno2.jsonc
+++ b/cli/tests/testdata/bench/collect/deno2.jsonc
@@ -1,8 +1,6 @@
{
- "bench": {
- "files": {
- "include": ["./include/"],
- "exclude": ["./ignore", "./include/2_bench.ts"]
- }
- }
+ "bench": {
+ "include": ["./include/"],
+ "exclude": ["./ignore", "./include/2_bench.ts"]
+ }
}
diff --git a/cli/tests/testdata/bench/collect_with_malformed_config.out b/cli/tests/testdata/bench/collect_with_malformed_config.out
index 10e64707c..92e5e29d2 100644
--- a/cli/tests/testdata/bench/collect_with_malformed_config.out
+++ b/cli/tests/testdata/bench/collect_with_malformed_config.out
@@ -1,4 +1,4 @@
error: Failed to parse "bench" configuration
Caused by:
- unknown field `dont_know_this_field`, expected `files`
+ unknown field `dont_know_this_field`, expected one of `include`, `exclude`, `files`
diff --git a/cli/tests/testdata/fmt/deno.malformed.jsonc b/cli/tests/testdata/fmt/deno.malformed.jsonc
index c6200c4ee..e326edb1f 100644
--- a/cli/tests/testdata/fmt/deno.malformed.jsonc
+++ b/cli/tests/testdata/fmt/deno.malformed.jsonc
@@ -1,9 +1,7 @@
{
"fmt": {
- "files": {
- "include": ["fmt_with_config/"],
- "exclude": ["fmt_with_config/b.ts"]
- },
+ "include": ["fmt_with_config/"],
+ "exclude": ["fmt_with_config/b.ts"],
"dont_know_this_field": {},
"options": {
"useTabs": true
diff --git a/cli/tests/testdata/fmt/deno.malformed2.jsonc b/cli/tests/testdata/fmt/deno.malformed2.jsonc
index 4d6e99ae2..e326edb1f 100644
--- a/cli/tests/testdata/fmt/deno.malformed2.jsonc
+++ b/cli/tests/testdata/fmt/deno.malformed2.jsonc
@@ -1,10 +1,8 @@
{
"fmt": {
- "files": {
- "include": ["fmt_with_config/"],
- "exclude": ["fmt_with_config/b.ts"],
- "dont_know_this_field": {}
- },
+ "include": ["fmt_with_config/"],
+ "exclude": ["fmt_with_config/b.ts"],
+ "dont_know_this_field": {},
"options": {
"useTabs": true
}
diff --git a/cli/tests/testdata/fmt/fmt_with_deprecated_config.out b/cli/tests/testdata/fmt/fmt_with_deprecated_config.out
new file mode 100644
index 000000000..793fac1bc
--- /dev/null
+++ b/cli/tests/testdata/fmt/fmt_with_deprecated_config.out
@@ -0,0 +1,3 @@
+Warning: "options" configuration is deprecated. Please use "flat" options instead.
+Warning: "files" configuration is deprecated. Please use "include" and "exclude" instead.
+Checked 2 files
diff --git a/cli/tests/testdata/fmt/fmt_with_malformed_config.out b/cli/tests/testdata/fmt/fmt_with_malformed_config.out
index 1a55613ef..c269053a6 100644
--- a/cli/tests/testdata/fmt/fmt_with_malformed_config.out
+++ b/cli/tests/testdata/fmt/fmt_with_malformed_config.out
@@ -1,4 +1,4 @@
error: Failed to parse "fmt" configuration
Caused by:
- unknown field `dont_know_this_field`, expected `options` or `files`
+ unknown field `dont_know_this_field`, expected one of `useTabs`, `lineWidth`, `indentWidth`, `singleQuote`, `proseWrap`, `semiColons`, `options`, `include`, `exclude`, `files`
diff --git a/cli/tests/testdata/fmt/fmt_with_malformed_config2.out b/cli/tests/testdata/fmt/fmt_with_malformed_config2.out
index 948b6b5b8..c269053a6 100644
--- a/cli/tests/testdata/fmt/fmt_with_malformed_config2.out
+++ b/cli/tests/testdata/fmt/fmt_with_malformed_config2.out
@@ -1,4 +1,4 @@
error: Failed to parse "fmt" configuration
Caused by:
- unknown field `dont_know_this_field`, expected `include` or `exclude`
+ unknown field `dont_know_this_field`, expected one of `useTabs`, `lineWidth`, `indentWidth`, `singleQuote`, `proseWrap`, `semiColons`, `options`, `include`, `exclude`, `files`
diff --git a/cli/tests/testdata/fmt/with_config/deno.deprecated.jsonc b/cli/tests/testdata/fmt/with_config/deno.deprecated.jsonc
new file mode 100644
index 000000000..e053233fd
--- /dev/null
+++ b/cli/tests/testdata/fmt/with_config/deno.deprecated.jsonc
@@ -0,0 +1,20 @@
+{
+ "fmt": {
+ "files": {
+ "include": [
+ "./subdir/"
+ ],
+ "exclude": [
+ "./subdir/b.ts"
+ ]
+ },
+ "options": {
+ "useTabs": true,
+ "lineWidth": 40,
+ "indentWidth": 8,
+ "singleQuote": true,
+ "proseWrap": "always",
+ "semiColons": false
+ }
+ }
+}
diff --git a/cli/tests/testdata/fmt/with_config/deno.jsonc b/cli/tests/testdata/fmt/with_config/deno.jsonc
index 44e3f9a99..ffd265dcd 100644
--- a/cli/tests/testdata/fmt/with_config/deno.jsonc
+++ b/cli/tests/testdata/fmt/with_config/deno.jsonc
@@ -1,20 +1,16 @@
{
"fmt": {
- "files": {
- "include": [
- "./subdir/"
- ],
- "exclude": [
- "./subdir/b.ts"
- ]
- },
- "options": {
- "useTabs": true,
- "lineWidth": 40,
- "indentWidth": 8,
- "singleQuote": true,
- "proseWrap": "always",
- "semiColons": false
- }
+ "include": [
+ "./subdir/"
+ ],
+ "exclude": [
+ "./subdir/b.ts"
+ ],
+ "useTabs": true,
+ "lineWidth": 40,
+ "indentWidth": 8,
+ "singleQuote": true,
+ "proseWrap": "always",
+ "semiColons": false
}
}
diff --git a/cli/tests/testdata/lint/Deno.compact.format.jsonc b/cli/tests/testdata/lint/Deno.compact.format.jsonc
index 24b159ca6..f3487501a 100644
--- a/cli/tests/testdata/lint/Deno.compact.format.jsonc
+++ b/cli/tests/testdata/lint/Deno.compact.format.jsonc
@@ -1,9 +1,7 @@
{
"lint": {
- "files": {
- "include": ["with_config/"],
- "exclude": ["with_config/b.ts"]
- },
+ "include": ["with_config/"],
+ "exclude": ["with_config/b.ts"],
"rules": {
"tags": ["recommended"],
"include": ["ban-untagged-todo"]
diff --git a/cli/tests/testdata/lint/Deno.jsonc b/cli/tests/testdata/lint/Deno.jsonc
index 24db221a7..e9c03cca4 100644
--- a/cli/tests/testdata/lint/Deno.jsonc
+++ b/cli/tests/testdata/lint/Deno.jsonc
@@ -1,9 +1,7 @@
{
"lint": {
- "files": {
- "include": ["with_config/"],
- "exclude": ["with_config/b.ts"]
- },
+ "include": ["with_config/"],
+ "exclude": ["with_config/b.ts"],
"rules": {
"tags": ["recommended"],
"include": ["ban-untagged-todo"]
diff --git a/cli/tests/testdata/lint/Deno.malformed.jsonc b/cli/tests/testdata/lint/Deno.malformed.jsonc
index 4534a1fe8..fa71cd851 100644
--- a/cli/tests/testdata/lint/Deno.malformed.jsonc
+++ b/cli/tests/testdata/lint/Deno.malformed.jsonc
@@ -1,9 +1,7 @@
{
"lint": {
- "files": {
- "include": ["with_config/"],
- "exclude": ["with_config/b.ts"]
- },
+ "include": ["with_config/"],
+ "exclude": ["with_config/b.ts"],
"dont_know_this_field": {},
"rules": {
"tags": ["recommended"],
diff --git a/cli/tests/testdata/lint/Deno.malformed2.jsonc b/cli/tests/testdata/lint/Deno.malformed2.jsonc
index 335fcdc23..fa71cd851 100644
--- a/cli/tests/testdata/lint/Deno.malformed2.jsonc
+++ b/cli/tests/testdata/lint/Deno.malformed2.jsonc
@@ -1,10 +1,8 @@
{
"lint": {
- "files": {
- "include": ["with_config/"],
- "exclude": ["with_config/b.ts"],
- "dont_know_this_field": {}
- },
+ "include": ["with_config/"],
+ "exclude": ["with_config/b.ts"],
+ "dont_know_this_field": {},
"rules": {
"tags": ["recommended"],
"include": ["ban-untagged-todo"]
diff --git a/cli/tests/testdata/lint/Deno.no_tags.jsonc b/cli/tests/testdata/lint/Deno.no_tags.jsonc
index 4771b0b73..b63600a90 100644
--- a/cli/tests/testdata/lint/Deno.no_tags.jsonc
+++ b/cli/tests/testdata/lint/Deno.no_tags.jsonc
@@ -1,13 +1,11 @@
{
"lint": {
- "files": {
- "include": [
- "with_config/"
- ],
- "exclude": [
- "with_config/b.ts"
- ]
- },
+ "include": [
+ "with_config/"
+ ],
+ "exclude": [
+ "with_config/b.ts"
+ ],
"rules": {
"include": [
"ban-untagged-todo"
diff --git a/cli/tests/testdata/lint/with_malformed_config.out b/cli/tests/testdata/lint/with_malformed_config.out
index 3aa491065..1c0f0fff6 100644
--- a/cli/tests/testdata/lint/with_malformed_config.out
+++ b/cli/tests/testdata/lint/with_malformed_config.out
@@ -1,4 +1,4 @@
error: Failed to parse "lint" configuration
Caused by:
- unknown field `dont_know_this_field`, expected one of `rules`, `files`, `report`
+ unknown field `dont_know_this_field`, expected one of `rules`, `include`, `exclude`, `files`, `report`
diff --git a/cli/tests/testdata/lint/with_malformed_config2.out b/cli/tests/testdata/lint/with_malformed_config2.out
index 11e878f00..1c0f0fff6 100644
--- a/cli/tests/testdata/lint/with_malformed_config2.out
+++ b/cli/tests/testdata/lint/with_malformed_config2.out
@@ -1,4 +1,4 @@
error: Failed to parse "lint" configuration
Caused by:
- unknown field `dont_know_this_field`, expected `include` or `exclude`
+ unknown field `dont_know_this_field`, expected one of `rules`, `include`, `exclude`, `files`, `report`
diff --git a/cli/tests/testdata/lsp/deno.lint.exclude.jsonc b/cli/tests/testdata/lsp/deno.lint.exclude.jsonc
index 89f6108ec..9d4ba52ad 100644
--- a/cli/tests/testdata/lsp/deno.lint.exclude.jsonc
+++ b/cli/tests/testdata/lsp/deno.lint.exclude.jsonc
@@ -1,10 +1,8 @@
{
"lint": {
- "files": {
- "exclude": [
- "ignored.ts"
- ]
- },
+ "exclude": [
+ "ignored.ts"
+ ],
"rules": {
"exclude": [
"camelcase"
diff --git a/cli/tests/testdata/test/collect.deprecated.out b/cli/tests/testdata/test/collect.deprecated.out
new file mode 100644
index 000000000..9bf68807c
--- /dev/null
+++ b/cli/tests/testdata/test/collect.deprecated.out
@@ -0,0 +1,10 @@
+Warning: "files" configuration is deprecated. Please use "include" and "exclude" instead.
+Check [WILDCARD]/test/collect/include/2_test.ts
+Check [WILDCARD]/test/collect/include/test.ts
+Check [WILDCARD]/test/collect/test.ts
+running 0 tests from ./test/collect/include/2_test.ts
+running 0 tests from ./test/collect/include/test.ts
+running 0 tests from ./test/collect/test.ts
+
+ok | 0 passed | 0 failed ([WILDCARD])
+
diff --git a/cli/tests/testdata/test/collect/deno.deprecated.jsonc b/cli/tests/testdata/test/collect/deno.deprecated.jsonc
new file mode 100644
index 000000000..b8acda27d
--- /dev/null
+++ b/cli/tests/testdata/test/collect/deno.deprecated.jsonc
@@ -0,0 +1,7 @@
+{
+ "test": {
+ "files": {
+ "exclude": ["./ignore"]
+ }
+ }
+}
diff --git a/cli/tests/testdata/test/collect/deno.jsonc b/cli/tests/testdata/test/collect/deno.jsonc
index b8acda27d..e14ce86da 100644
--- a/cli/tests/testdata/test/collect/deno.jsonc
+++ b/cli/tests/testdata/test/collect/deno.jsonc
@@ -1,7 +1,5 @@
{
"test": {
- "files": {
- "exclude": ["./ignore"]
- }
+ "exclude": ["./ignore"]
}
}
diff --git a/cli/tests/testdata/test/collect/deno2.jsonc b/cli/tests/testdata/test/collect/deno2.jsonc
index a4d244e31..b7af09d1c 100644
--- a/cli/tests/testdata/test/collect/deno2.jsonc
+++ b/cli/tests/testdata/test/collect/deno2.jsonc
@@ -1,8 +1,6 @@
{
"test": {
- "files": {
- "include": ["./include/"],
- "exclude": ["./ignore", "./include/2_test.ts"]
- }
+ "include": ["./include/"],
+ "exclude": ["./ignore", "./include/2_test.ts"]
}
}
diff --git a/cli/tests/testdata/test/collect_with_malformed_config.out b/cli/tests/testdata/test/collect_with_malformed_config.out
index 25c34406f..b31b18e6a 100644
--- a/cli/tests/testdata/test/collect_with_malformed_config.out
+++ b/cli/tests/testdata/test/collect_with_malformed_config.out
@@ -1,4 +1,4 @@
error: Failed to parse "test" configuration
Caused by:
- unknown field `dont_know_this_field`, expected `files`
+ unknown field `dont_know_this_field`, expected one of `include`, `exclude`, `files`