summaryrefslogtreecommitdiff
path: root/cli/tests/unit
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit')
-rw-r--r--cli/tests/unit/opcall_test.ts4
-rw-r--r--cli/tests/unit/text_encoding_test.ts1
-rw-r--r--cli/tests/unit/write_file_test.ts3
3 files changed, 7 insertions, 1 deletions
diff --git a/cli/tests/unit/opcall_test.ts b/cli/tests/unit/opcall_test.ts
index 7e3685320..e38f481d9 100644
--- a/cli/tests/unit/opcall_test.ts
+++ b/cli/tests/unit/opcall_test.ts
@@ -12,7 +12,9 @@ unitTest(async function sendAsyncStackTrace() {
await Deno.read(rid, buf);
unreachable();
} catch (error) {
- const s = error.stack.toString();
+ assert(error instanceof Error);
+ const s = error.stack?.toString();
+ assert(s);
console.log(s);
assertStringIncludes(s, "opcall_test.ts");
assertStringIncludes(s, "read");
diff --git a/cli/tests/unit/text_encoding_test.ts b/cli/tests/unit/text_encoding_test.ts
index a65a4176b..d83d84584 100644
--- a/cli/tests/unit/text_encoding_test.ts
+++ b/cli/tests/unit/text_encoding_test.ts
@@ -98,6 +98,7 @@ unitTest(function textDecoderErrorEncoding() {
new TextDecoder("Foo");
} catch (e) {
didThrow = true;
+ assert(e instanceof Error);
assertEquals(e.message, "The encoding label provided ('Foo') is invalid.");
}
assert(didThrow);
diff --git a/cli/tests/unit/write_file_test.ts b/cli/tests/unit/write_file_test.ts
index 0f99e2749..9ad8da578 100644
--- a/cli/tests/unit/write_file_test.ts
+++ b/cli/tests/unit/write_file_test.ts
@@ -1,5 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
import {
+ assert,
assertEquals,
assertRejects,
assertThrows,
@@ -251,6 +252,7 @@ unitTest(
try {
await Deno.writeFile(filename, data, { signal: ac.signal });
} catch (e) {
+ assert(e instanceof Error);
assertEquals(e.name, "AbortError");
}
const stat = Deno.statSync(filename);
@@ -269,6 +271,7 @@ unitTest(
try {
await Deno.writeFile(filename, data, { signal: ac.signal });
} catch (e) {
+ assert(e instanceof Error);
assertEquals(e.name, "AbortError");
}
const stat = Deno.statSync(filename);