summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2024-09-05 15:22:31 +0200
committerGitHub <noreply@github.com>2024-09-05 15:22:31 +0200
commit15fce5b290d7dc3eb503a70bd8a10aaf72a09f5e (patch)
treea236e2de82f91b8a36cb5228db119f116fe05c06 /tests
parentb54347c448ca4a003b81800655eb1433fc842b2a (diff)
feat(check): turn on useUnknownInCatchVariables (#25465)
Part of #25162 Closes #11826
Diffstat (limited to 'tests')
-rw-r--r--tests/specs/compile/relative_permissions/main.ts2
-rw-r--r--tests/testdata/run/resolve_dns.ts6
-rw-r--r--tests/unit/kv_queue_test.ts2
-rw-r--r--tests/unit/net_test.ts2
-rw-r--r--tests/unit/read_file_test.ts4
-rw-r--r--tests/unit/streams_test.ts6
-rw-r--r--tests/unit/tls_test.ts4
-rw-r--r--tests/unit_node/module_test.ts2
8 files changed, 15 insertions, 13 deletions
diff --git a/tests/specs/compile/relative_permissions/main.ts b/tests/specs/compile/relative_permissions/main.ts
index ac6eebba2..d18d27cad 100644
--- a/tests/specs/compile/relative_permissions/main.ts
+++ b/tests/specs/compile/relative_permissions/main.ts
@@ -1,5 +1,5 @@
try {
Deno.readTextFileSync("a.txt");
} catch (err) {
- console.log(err.message);
+ console.log((err as Error).message);
}
diff --git a/tests/testdata/run/resolve_dns.ts b/tests/testdata/run/resolve_dns.ts
index a2d0fd046..163a68f33 100644
--- a/tests/testdata/run/resolve_dns.ts
+++ b/tests/testdata/run/resolve_dns.ts
@@ -67,7 +67,7 @@ try {
// @ts-ignore testing invalid overloads
await Deno.resolveDns("example.com", "SSHFP", nameServer);
} catch (e) {
- console.log(e.message);
+ console.log((e as Error).message);
}
try {
@@ -78,7 +78,7 @@ try {
signal: ac.signal,
});
} catch (e) {
- console.log(e.name);
+ console.log((e as Error).name);
}
try {
@@ -89,5 +89,5 @@ try {
signal: ac.signal,
});
} catch (e) {
- console.log(e.name);
+ console.log((e as Error).name);
}
diff --git a/tests/unit/kv_queue_test.ts b/tests/unit/kv_queue_test.ts
index e052dcbf7..af5771298 100644
--- a/tests/unit/kv_queue_test.ts
+++ b/tests/unit/kv_queue_test.ts
@@ -8,6 +8,6 @@ Deno.test({}, async function queueTestDbClose() {
await db.listenQueue(() => {});
assertFalse(false);
} catch (e) {
- assertEquals(e.message, "already closed");
+ assertEquals((e as Error).message, "already closed");
}
});
diff --git a/tests/unit/net_test.ts b/tests/unit/net_test.ts
index 9cd3094e5..1428a804f 100644
--- a/tests/unit/net_test.ts
+++ b/tests/unit/net_test.ts
@@ -443,7 +443,7 @@ Deno.test(
// Note: we have to do the test this way as different OS's have
// different UDP size limits enabled, so we will just ensure if
// an error is thrown it is the one we are expecting.
- assert(err.message.match(rx));
+ assert((err as Error).message.match(rx));
alice.close();
bob.close();
return;
diff --git a/tests/unit/read_file_test.ts b/tests/unit/read_file_test.ts
index 67944813b..6aea6f7af 100644
--- a/tests/unit/read_file_test.ts
+++ b/tests/unit/read_file_test.ts
@@ -161,7 +161,7 @@ Deno.test(
try {
await Deno.readFile("definitely-not-found.json");
} catch (e) {
- assertEquals(e.code, "ENOENT");
+ assertEquals((e as { code: string }).code, "ENOENT");
}
},
);
@@ -172,7 +172,7 @@ Deno.test(
try {
await Deno.readFile("tests/testdata/assets/");
} catch (e) {
- assertEquals(e.code, "EISDIR");
+ assertEquals((e as { code: string }).code, "EISDIR");
}
},
);
diff --git a/tests/unit/streams_test.ts b/tests/unit/streams_test.ts
index 80b45e602..b866fa7d5 100644
--- a/tests/unit/streams_test.ts
+++ b/tests/unit/streams_test.ts
@@ -298,7 +298,7 @@ for (
await core.read(rid, new Uint8Array(1));
fail();
} catch (e) {
- assertEquals(e.message, `Uh oh (${type})!`);
+ assertEquals((e as Error).message, `Uh oh (${type})!`);
}
core.close(rid);
});
@@ -429,7 +429,7 @@ function createStreamTest(
fail();
} catch (e) {
// We expect this to be thrown
- assertEquals(e.message, "Expected error!");
+ assertEquals((e as Error).message, "Expected error!");
}
} else {
const buffer = new Uint8Array(1);
@@ -471,7 +471,7 @@ for (const packetCount of [1, 1024]) {
}
fail();
} catch (e) {
- assertEquals(e.message, "operation canceled");
+ assertEquals((e as Error).message, "operation canceled");
}
assertEquals(await promise, "resource closed");
});
diff --git a/tests/unit/tls_test.ts b/tests/unit/tls_test.ts
index 1facd0f98..e5b9a02c3 100644
--- a/tests/unit/tls_test.ts
+++ b/tests/unit/tls_test.ts
@@ -588,7 +588,9 @@ async function receiveAlotSendNothing(conn: Deno.Conn) {
}
} catch (e) {
throw new Error(
- `Got an error (${e.message}) after reading ${nread}/${largeAmount} bytes`,
+ `Got an error (${
+ (e as Error).message
+ }) after reading ${nread}/${largeAmount} bytes`,
{ cause: e },
);
}
diff --git a/tests/unit_node/module_test.ts b/tests/unit_node/module_test.ts
index 994dcfb63..96c3504bd 100644
--- a/tests/unit_node/module_test.ts
+++ b/tests/unit_node/module_test.ts
@@ -74,7 +74,7 @@ Deno.test("Built-in Node modules have `node:` prefix", () => {
createRequire();
} catch (e) {
thrown = true;
- const stackLines = e.stack.split("\n");
+ const stackLines = (e as Error).stack!.split("\n");
// Assert that built-in node modules have `node:<mod_name>` specifiers.
assert(stackLines.some((line: string) => line.includes("(node:module:")));
}