summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/integration/test_tests.rs6
-rw-r--r--cli/tests/testdata/test/report_error.out23
-rw-r--r--cli/tests/testdata/test/report_error.ts6
3 files changed, 35 insertions, 0 deletions
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs
index 0e1a39deb..223c02e24 100644
--- a/cli/tests/integration/test_tests.rs
+++ b/cli/tests/integration/test_tests.rs
@@ -425,6 +425,12 @@ itest!(uncaught_errors {
exit_code: 1,
});
+itest!(report_error {
+ args: "test --quiet test/report_error.ts",
+ output: "test/report_error.out",
+ exit_code: 1,
+});
+
itest!(check_local_by_default {
args: "test --quiet test/check_local_by_default.ts",
output: "test/check_local_by_default.out",
diff --git a/cli/tests/testdata/test/report_error.out b/cli/tests/testdata/test/report_error.out
new file mode 100644
index 000000000..698550f97
--- /dev/null
+++ b/cli/tests/testdata/test/report_error.out
@@ -0,0 +1,23 @@
+running 2 tests from [WILDCARD]/report_error.ts
+foo ...
+Uncaught error from [WILDCARD]/report_error.ts FAILED
+foo ... cancelled (0ms)
+bar ... cancelled (0ms)
+
+ ERRORS
+
+[WILDCARD]/report_error.ts (uncaught error)
+error: Error: foo
+ reportError(new Error("foo"));
+ ^
+ at [WILDCARD]/report_error.ts:2:15
+This error was not caught from a test and caused the test runner to fail on the referenced module.
+It most likely originated from a dangling promise, event/timeout handler or top-level code.
+
+ FAILURES
+
+[WILDCARD]/report_error.ts (uncaught error)
+
+FAILED | 0 passed | 3 failed ([WILDCARD])
+
+error: Test failed
diff --git a/cli/tests/testdata/test/report_error.ts b/cli/tests/testdata/test/report_error.ts
new file mode 100644
index 000000000..56b6db26c
--- /dev/null
+++ b/cli/tests/testdata/test/report_error.ts
@@ -0,0 +1,6 @@
+Deno.test("foo", () => {
+ reportError(new Error("foo"));
+ console.log(1);
+});
+
+Deno.test("bar", () => {});