summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHajime-san <41257923+Hajime-san@users.noreply.github.com>2024-08-20 10:27:36 +0900
committerGitHub <noreply@github.com>2024-08-20 01:27:36 +0000
commit19bcb40059f6ba730b6d05d8edf005c6b40f6ff8 (patch)
treee7c60d8957a8609199a3dad24455518cc36fac32 /tests
parent4f49f703c10afcde7155baac2b494fa6670c0115 (diff)
feat(cli/tools): add a subcommand `--hide-stacktraces` for test (#24095)
Diffstat (limited to 'tests')
-rw-r--r--tests/registry/jsr/@std/assert/1.0.0_meta.json2
-rw-r--r--tests/specs/remove/basic/add_lock.out4
-rw-r--r--tests/specs/test/hide_stacktraces/__test__.jsonc24
-rw-r--r--tests/specs/test/hide_stacktraces/dot.out23
-rw-r--r--tests/specs/test/hide_stacktraces/junit.out27
-rw-r--r--tests/specs/test/hide_stacktraces/main.js8
-rw-r--r--tests/specs/test/hide_stacktraces/pretty.out24
-rw-r--r--tests/specs/test/hide_stacktraces/tap.out8
8 files changed, 117 insertions, 3 deletions
diff --git a/tests/registry/jsr/@std/assert/1.0.0_meta.json b/tests/registry/jsr/@std/assert/1.0.0_meta.json
index 3ca2db93a..5bac06209 100644
--- a/tests/registry/jsr/@std/assert/1.0.0_meta.json
+++ b/tests/registry/jsr/@std/assert/1.0.0_meta.json
@@ -2,7 +2,7 @@
"exports": {
".": "./mod.ts",
"./assert": "./assert.ts",
- "./assert-equals": "./assert-equals.ts",
+ "./assert-equals": "./assert_equals.ts",
"./fail": "./fail.ts"
}
}
diff --git a/tests/specs/remove/basic/add_lock.out b/tests/specs/remove/basic/add_lock.out
index a5a45e854..cda0fc34a 100644
--- a/tests/specs/remove/basic/add_lock.out
+++ b/tests/specs/remove/basic/add_lock.out
@@ -7,10 +7,10 @@
},
"jsr": {
"@std/assert@1.0.0": {
- "integrity": "7ae268c58de9693b4997fd93d9b303a47df336664e2008378ccb93c3458d092a"
+ "integrity": "[WILDLINE]"
},
"@std/http@1.0.0": {
- "integrity": "d75bd303c21123a9b58f7249e38b4c0aa3a09f7d76b13f9d7e7842d89052091a"
+ "integrity": "[WILDLINE]"
}
}
},
diff --git a/tests/specs/test/hide_stacktraces/__test__.jsonc b/tests/specs/test/hide_stacktraces/__test__.jsonc
new file mode 100644
index 000000000..963873df3
--- /dev/null
+++ b/tests/specs/test/hide_stacktraces/__test__.jsonc
@@ -0,0 +1,24 @@
+{
+ "tests": {
+ "reporter_dot": {
+ "args": "test --hide-stacktraces --reporter=dot main.js",
+ "output": "dot.out",
+ "exitCode": 1
+ },
+ "reporter_junit": {
+ "args": "test --hide-stacktraces --reporter=junit main.js",
+ "output": "junit.out",
+ "exitCode": 1
+ },
+ "reporter_pretty": {
+ "args": "test --hide-stacktraces main.js",
+ "output": "pretty.out",
+ "exitCode": 1
+ },
+ "reporter_tap": {
+ "args": "test --hide-stacktraces --reporter=tap main.js",
+ "output": "tap.out",
+ "exitCode": 1
+ }
+ }
+}
diff --git a/tests/specs/test/hide_stacktraces/dot.out b/tests/specs/test/hide_stacktraces/dot.out
new file mode 100644
index 000000000..abda749f1
--- /dev/null
+++ b/tests/specs/test/hide_stacktraces/dot.out
@@ -0,0 +1,23 @@
+!
+
+ ERRORS
+
+assert a b => ./main.js:1:6
+error: AssertionError: Values are not equal.
+
+
+ [Diff] Actual / Expected
+
+
+- foo
++ bar
+
+
+
+ FAILURES
+
+assert a b => ./main.js:1:6
+
+FAILED | 0 passed | 1 failed ([WILDCARD])
+
+error: Test failed
diff --git a/tests/specs/test/hide_stacktraces/junit.out b/tests/specs/test/hide_stacktraces/junit.out
new file mode 100644
index 000000000..483c4764b
--- /dev/null
+++ b/tests/specs/test/hide_stacktraces/junit.out
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<testsuites name="deno test" tests="1" failures="1" errors="0" time="[WILDCARD]">
+ <testsuite name="./main.js" tests="1" disabled="0" errors="0" failures="1">
+ <testcase name="assert a b" classname="./main.js" time="[WILDCARD]" line="1" col="6">
+ <failure message="Uncaught AssertionError: Values are not equal.
+
+
+ [Diff] Actual / Expected
+
+
+- foo
++ bar
+
+">AssertionError: Values are not equal.
+
+
+ [Diff] Actual / Expected
+
+
+- foo
++ bar
+
+</failure>
+ </testcase>
+ </testsuite>
+</testsuites>
+error: Test failed
diff --git a/tests/specs/test/hide_stacktraces/main.js b/tests/specs/test/hide_stacktraces/main.js
new file mode 100644
index 000000000..5e9d186fb
--- /dev/null
+++ b/tests/specs/test/hide_stacktraces/main.js
@@ -0,0 +1,8 @@
+Deno.test("assert a b", () => {
+ class AssertionError extends Error {
+ name = "AssertionError";
+ }
+ throw new AssertionError(
+ "Values are not equal.\n\n\n [Diff] Actual / Expected\n\n\n- foo\n+ bar\n\n",
+ );
+});
diff --git a/tests/specs/test/hide_stacktraces/pretty.out b/tests/specs/test/hide_stacktraces/pretty.out
new file mode 100644
index 000000000..7e107e8e7
--- /dev/null
+++ b/tests/specs/test/hide_stacktraces/pretty.out
@@ -0,0 +1,24 @@
+running 1 test from ./main.js
+assert a b ... FAILED ([WILDCARD])
+
+ ERRORS
+
+assert a b => ./main.js:1:6
+error: AssertionError: Values are not equal.
+
+
+ [Diff] Actual / Expected
+
+
+- foo
++ bar
+
+
+
+ FAILURES
+
+assert a b => ./main.js:1:6
+
+FAILED | 0 passed | 1 failed ([WILDCARD])
+
+error: Test failed
diff --git a/tests/specs/test/hide_stacktraces/tap.out b/tests/specs/test/hide_stacktraces/tap.out
new file mode 100644
index 000000000..b91c86108
--- /dev/null
+++ b/tests/specs/test/hide_stacktraces/tap.out
@@ -0,0 +1,8 @@
+TAP version 14
+# ./main.js
+not ok 1 - assert a b
+ ---
+ {"message":"AssertionError: Values are not equal.\n\n\n [Diff] Actual / Expected\n\n\n- foo\n+ bar\n\n","severity":"fail","at":{"file":"./main.js","line":1}}
+ ...
+1..1
+error: Test failed