summaryrefslogtreecommitdiff
path: root/tests/specs/fmt
diff options
context:
space:
mode:
Diffstat (limited to 'tests/specs/fmt')
-rw-r--r--tests/specs/fmt/gitignore/.gitignore1
-rw-r--r--tests/specs/fmt/gitignore/__test__.jsonc6
-rw-r--r--tests/specs/fmt/gitignore/dist/file1.js6
-rw-r--r--tests/specs/fmt/gitignore/expected.out10
-rw-r--r--tests/specs/fmt/gitignore/file2.ts3
-rw-r--r--tests/specs/fmt/html/well_formatted.html2
-rw-r--r--tests/specs/fmt/yaml/__test__.jsonc24
-rw-r--r--tests/specs/fmt/yaml/ignore_file.yaml2
-rw-r--r--tests/specs/fmt/yaml/ignore_file2.yaml2
-rw-r--r--tests/specs/fmt/yaml/ignore_file3.yaml5
-rw-r--r--tests/specs/fmt/yaml/ignore_file4.yaml2
-rw-r--r--tests/specs/fmt/yaml/ignore_line.yml2
-rw-r--r--tests/specs/fmt/yaml/wrong_file_ignore.out7
-rw-r--r--tests/specs/fmt/yaml/wrong_file_ignore.yaml5
14 files changed, 76 insertions, 1 deletions
diff --git a/tests/specs/fmt/gitignore/.gitignore b/tests/specs/fmt/gitignore/.gitignore
new file mode 100644
index 000000000..838458f20
--- /dev/null
+++ b/tests/specs/fmt/gitignore/.gitignore
@@ -0,0 +1 @@
+/dist/ \ No newline at end of file
diff --git a/tests/specs/fmt/gitignore/__test__.jsonc b/tests/specs/fmt/gitignore/__test__.jsonc
new file mode 100644
index 000000000..94804c3fe
--- /dev/null
+++ b/tests/specs/fmt/gitignore/__test__.jsonc
@@ -0,0 +1,6 @@
+{
+ "tempDir": true,
+ "args": "fmt --check",
+ "output": "expected.out",
+ "exitCode": 1
+}
diff --git a/tests/specs/fmt/gitignore/dist/file1.js b/tests/specs/fmt/gitignore/dist/file1.js
new file mode 100644
index 000000000..3ecf5aa6a
--- /dev/null
+++ b/tests/specs/fmt/gitignore/dist/file1.js
@@ -0,0 +1,6 @@
+// This file is in `.gitignore` simulating that it's generated by a build tool
+// and should not be linted
+function foo( ) {
+ console.log( "hello")
+ }
+ \ No newline at end of file
diff --git a/tests/specs/fmt/gitignore/expected.out b/tests/specs/fmt/gitignore/expected.out
new file mode 100644
index 000000000..73568ff3a
--- /dev/null
+++ b/tests/specs/fmt/gitignore/expected.out
@@ -0,0 +1,10 @@
+
+from [WILDCARD]file2.ts:
+1 | -function foo( ): any {
+1 | +function foo(): any {
+2 | - console.log( "hello")
+2 | + console.log("hello");
+3 | - }
+3 | +}
+
+error: Found 1 not formatted file in 1 file
diff --git a/tests/specs/fmt/gitignore/file2.ts b/tests/specs/fmt/gitignore/file2.ts
new file mode 100644
index 000000000..0e5fdd36d
--- /dev/null
+++ b/tests/specs/fmt/gitignore/file2.ts
@@ -0,0 +1,3 @@
+function foo( ): any {
+ console.log( "hello")
+ }
diff --git a/tests/specs/fmt/html/well_formatted.html b/tests/specs/fmt/html/well_formatted.html
index c0c06cd9b..7af705c04 100644
--- a/tests/specs/fmt/html/well_formatted.html
+++ b/tests/specs/fmt/html/well_formatted.html
@@ -1,4 +1,4 @@
-<div class="container">content</div>
+<div class="container">content<br></div>
<script>
let counter = 0;
diff --git a/tests/specs/fmt/yaml/__test__.jsonc b/tests/specs/fmt/yaml/__test__.jsonc
index 499b4144b..71a2e0682 100644
--- a/tests/specs/fmt/yaml/__test__.jsonc
+++ b/tests/specs/fmt/yaml/__test__.jsonc
@@ -8,6 +8,30 @@
"well_formatted": {
"args": "fmt --check well_formatted.yml",
"output": "Checked 1 file\n"
+ },
+ "ignore_line": {
+ "args": "fmt --check ignore_line.yml",
+ "output": "Checked 1 file\n"
+ },
+ "ignore_file": {
+ "args": "fmt ignore_file.yaml",
+ "output": "Checked 1 file\n"
+ },
+ "ignore_file2": {
+ "args": "fmt ignore_file2.yaml",
+ "output": "Checked 1 file\n"
+ },
+ "ignore_file3": {
+ "args": "fmt ignore_file3.yaml",
+ "output": "Checked 1 file\n"
+ },
+ "ignore_file4": {
+ "args": "fmt ignore_file4.yaml",
+ "output": "Checked 1 file\n"
+ },
+ "wrong_file_ignore": {
+ "args": "fmt wrong_file_ignore.yaml",
+ "output": "wrong_file_ignore.out"
}
}
}
diff --git a/tests/specs/fmt/yaml/ignore_file.yaml b/tests/specs/fmt/yaml/ignore_file.yaml
new file mode 100644
index 000000000..c724c7bde
--- /dev/null
+++ b/tests/specs/fmt/yaml/ignore_file.yaml
@@ -0,0 +1,2 @@
+# deno-fmt-ignore-file
+{{something crazy \ No newline at end of file
diff --git a/tests/specs/fmt/yaml/ignore_file2.yaml b/tests/specs/fmt/yaml/ignore_file2.yaml
new file mode 100644
index 000000000..a2053533e
--- /dev/null
+++ b/tests/specs/fmt/yaml/ignore_file2.yaml
@@ -0,0 +1,2 @@
+#deno-fmt-ignore-file
+{{something crazy \ No newline at end of file
diff --git a/tests/specs/fmt/yaml/ignore_file3.yaml b/tests/specs/fmt/yaml/ignore_file3.yaml
new file mode 100644
index 000000000..a3927a7b1
--- /dev/null
+++ b/tests/specs/fmt/yaml/ignore_file3.yaml
@@ -0,0 +1,5 @@
+# Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor
+# incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
+# quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
+# deno-fmt-ignore-file
+{{something crazy \ No newline at end of file
diff --git a/tests/specs/fmt/yaml/ignore_file4.yaml b/tests/specs/fmt/yaml/ignore_file4.yaml
new file mode 100644
index 000000000..c32fe9f2b
--- /dev/null
+++ b/tests/specs/fmt/yaml/ignore_file4.yaml
@@ -0,0 +1,2 @@
+# deno-fmt-ignore-file Because this is templated yaml file
+{{something crazy \ No newline at end of file
diff --git a/tests/specs/fmt/yaml/ignore_line.yml b/tests/specs/fmt/yaml/ignore_line.yml
new file mode 100644
index 000000000..490adcb5f
--- /dev/null
+++ b/tests/specs/fmt/yaml/ignore_line.yml
@@ -0,0 +1,2 @@
+# deno-fmt-ignore
+- Test
diff --git a/tests/specs/fmt/yaml/wrong_file_ignore.out b/tests/specs/fmt/yaml/wrong_file_ignore.out
new file mode 100644
index 000000000..065dc98db
--- /dev/null
+++ b/tests/specs/fmt/yaml/wrong_file_ignore.out
@@ -0,0 +1,7 @@
+Error formatting: [WILDCARD]wrong_file_ignore.yaml
+ parse error at line 5, column 1
+ |
+5 | {{something crazy
+ | ^
+
+Checked 1 file
diff --git a/tests/specs/fmt/yaml/wrong_file_ignore.yaml b/tests/specs/fmt/yaml/wrong_file_ignore.yaml
new file mode 100644
index 000000000..8019d989d
--- /dev/null
+++ b/tests/specs/fmt/yaml/wrong_file_ignore.yaml
@@ -0,0 +1,5 @@
+# File ignore directive only works if it's in the first cluster
+# of comment, ie. there are no empty lines after the first n-leading lines.
+
+# deno-fmt-ignore-file
+{{something crazy \ No newline at end of file