summaryrefslogtreecommitdiff
path: root/cli/tests/test
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/test')
-rw-r--r--cli/tests/test/deno_test.out26
-rw-r--r--cli/tests/test/deno_test_fail_fast.out15
-rw-r--r--cli/tests/test/deno_test_no_color.ts17
-rw-r--r--cli/tests/test/deno_test_only.ts15
-rw-r--r--cli/tests/test/deno_test_only.ts.out7
-rw-r--r--cli/tests/test/deno_test_unresolved_promise.out4
-rw-r--r--cli/tests/test/exit_sanitizer_test.out28
-rw-r--r--cli/tests/test/exit_sanitizer_test.ts11
-rw-r--r--cli/tests/test/test_finally_cleartimeout.out17
-rw-r--r--cli/tests/test/test_finally_cleartimeout.ts11
-rw-r--r--cli/tests/test/test_runner_test.ts19
-rw-r--r--cli/tests/test/test_unresolved_promise.js15
12 files changed, 185 insertions, 0 deletions
diff --git a/cli/tests/test/deno_test.out b/cli/tests/test/deno_test.out
new file mode 100644
index 000000000..338f804ed
--- /dev/null
+++ b/cli/tests/test/deno_test.out
@@ -0,0 +1,26 @@
+[WILDCARD]
+running 4 tests
+test fail1 ... FAILED [WILDCARD]
+test fail2 ... FAILED [WILDCARD]
+test success1 ... ok [WILDCARD]
+test fail3 ... FAILED [WILDCARD]
+
+failures:
+
+fail1
+AssertionError: fail1 assertion
+[WILDCARD]
+
+fail2
+AssertionError: fail2 assertion
+[WILDCARD]
+
+fail3
+AssertionError: fail3 assertion
+[WILDCARD]
+
+failures:
+[WILDCARD]
+
+test result: FAILED. 1 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]
+
diff --git a/cli/tests/test/deno_test_fail_fast.out b/cli/tests/test/deno_test_fail_fast.out
new file mode 100644
index 000000000..9fb82c1c6
--- /dev/null
+++ b/cli/tests/test/deno_test_fail_fast.out
@@ -0,0 +1,15 @@
+[WILDCARD]
+running 4 tests
+test fail1 ... FAILED [WILDCARD]
+
+failures:
+
+fail1
+AssertionError: fail1 assertion
+[WILDCARD]
+
+failures:
+[WILDCARD]
+
+test result: FAILED. 0 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out [WILDCARD]
+
diff --git a/cli/tests/test/deno_test_no_color.ts b/cli/tests/test/deno_test_no_color.ts
new file mode 100644
index 000000000..38c531ee9
--- /dev/null
+++ b/cli/tests/test/deno_test_no_color.ts
@@ -0,0 +1,17 @@
+Deno.test({
+ name: "success",
+ fn() {},
+});
+
+Deno.test({
+ name: "fail",
+ fn() {
+ throw new Error("fail");
+ },
+});
+
+Deno.test({
+ name: "ignored",
+ ignore: true,
+ fn() {},
+});
diff --git a/cli/tests/test/deno_test_only.ts b/cli/tests/test/deno_test_only.ts
new file mode 100644
index 000000000..12425f21f
--- /dev/null
+++ b/cli/tests/test/deno_test_only.ts
@@ -0,0 +1,15 @@
+Deno.test({
+ name: "abc",
+ fn() {},
+});
+
+Deno.test({
+ only: true,
+ name: "def",
+ fn() {},
+});
+
+Deno.test({
+ name: "ghi",
+ fn() {},
+});
diff --git a/cli/tests/test/deno_test_only.ts.out b/cli/tests/test/deno_test_only.ts.out
new file mode 100644
index 000000000..a23f2505c
--- /dev/null
+++ b/cli/tests/test/deno_test_only.ts.out
@@ -0,0 +1,7 @@
+[WILDCARD]running 1 tests
+test def ... ok ([WILDCARD])
+
+test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
+
+FAILED because the "only" option was used
+
diff --git a/cli/tests/test/deno_test_unresolved_promise.out b/cli/tests/test/deno_test_unresolved_promise.out
new file mode 100644
index 000000000..cc4f2985e
--- /dev/null
+++ b/cli/tests/test/deno_test_unresolved_promise.out
@@ -0,0 +1,4 @@
+Check [WILDCARD]
+running 2 tests
+test unresolved promise ... in promise
+error: Module evaluation is still pending but there are no pending ops or dynamic imports. This situation is often caused by unresolved promise.
diff --git a/cli/tests/test/exit_sanitizer_test.out b/cli/tests/test/exit_sanitizer_test.out
new file mode 100644
index 000000000..351453928
--- /dev/null
+++ b/cli/tests/test/exit_sanitizer_test.out
@@ -0,0 +1,28 @@
+Check [WILDCARD]/$deno$test.ts
+running 3 tests
+test exit(0) ... FAILED ([WILDCARD])
+test exit(1) ... FAILED ([WILDCARD])
+test exit(2) ... FAILED ([WILDCARD])
+
+failures:
+
+exit(0)
+AssertionError: Test case attempted to exit with exit code: 0
+ [WILDCARD]
+
+exit(1)
+AssertionError: Test case attempted to exit with exit code: 1
+ [WILDCARD]
+
+exit(2)
+AssertionError: Test case attempted to exit with exit code: 2
+ [WILDCARD]
+
+failures:
+
+ exit(0)
+ exit(1)
+ exit(2)
+
+test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
+
diff --git a/cli/tests/test/exit_sanitizer_test.ts b/cli/tests/test/exit_sanitizer_test.ts
new file mode 100644
index 000000000..186406a9d
--- /dev/null
+++ b/cli/tests/test/exit_sanitizer_test.ts
@@ -0,0 +1,11 @@
+Deno.test("exit(0)", function () {
+ Deno.exit(0);
+});
+
+Deno.test("exit(1)", function () {
+ Deno.exit(1);
+});
+
+Deno.test("exit(2)", function () {
+ Deno.exit(2);
+});
diff --git a/cli/tests/test/test_finally_cleartimeout.out b/cli/tests/test/test_finally_cleartimeout.out
new file mode 100644
index 000000000..c88b8242b
--- /dev/null
+++ b/cli/tests/test/test_finally_cleartimeout.out
@@ -0,0 +1,17 @@
+Check [WILDCARD]/$deno$test.ts
+running 2 tests
+test error ... FAILED ([WILDCARD])
+test success ... ok ([WILDCARD])
+
+failures:
+
+error
+Error: fail
+ [WILDCARD]
+
+failures:
+
+ error
+
+test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out ([WILDCARD])
+
diff --git a/cli/tests/test/test_finally_cleartimeout.ts b/cli/tests/test/test_finally_cleartimeout.ts
new file mode 100644
index 000000000..dcc0a4d64
--- /dev/null
+++ b/cli/tests/test/test_finally_cleartimeout.ts
@@ -0,0 +1,11 @@
+Deno.test("error", function () {
+ const timer = setTimeout(() => null, 10000);
+ try {
+ throw new Error("fail");
+ } finally {
+ clearTimeout(timer);
+ }
+});
+
+Deno.test("success", function () {
+});
diff --git a/cli/tests/test/test_runner_test.ts b/cli/tests/test/test_runner_test.ts
new file mode 100644
index 000000000..111ff51c7
--- /dev/null
+++ b/cli/tests/test/test_runner_test.ts
@@ -0,0 +1,19 @@
+// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
+
+import { assert } from "../../../test_util/std/testing/asserts.ts";
+
+Deno.test("fail1", function () {
+ assert(false, "fail1 assertion");
+});
+
+Deno.test("fail2", function () {
+ assert(false, "fail2 assertion");
+});
+
+Deno.test("success1", function () {
+ assert(true);
+});
+
+Deno.test("fail3", function () {
+ assert(false, "fail3 assertion");
+});
diff --git a/cli/tests/test/test_unresolved_promise.js b/cli/tests/test/test_unresolved_promise.js
new file mode 100644
index 000000000..466b18864
--- /dev/null
+++ b/cli/tests/test/test_unresolved_promise.js
@@ -0,0 +1,15 @@
+Deno.test({
+ name: "unresolved promise",
+ fn() {
+ return new Promise((_resolve, _reject) => {
+ console.log("in promise");
+ });
+ },
+});
+
+Deno.test({
+ name: "ok",
+ fn() {
+ console.log("ok test");
+ },
+});