summaryrefslogtreecommitdiff
path: root/cli/tests
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests')
-rw-r--r--cli/tests/testdata/error_cause.ts3
-rw-r--r--cli/tests/testdata/error_cause.ts.out20
-rw-r--r--cli/tests/testdata/lsp/code_action_response_imports.json4
-rw-r--r--cli/tests/testdata/lsp/code_action_response_refactor.json16
-rw-r--r--cli/tests/unit/console_test.ts1
-rw-r--r--cli/tests/unit/esnext_test.ts16
6 files changed, 24 insertions, 36 deletions
diff --git a/cli/tests/testdata/error_cause.ts b/cli/tests/testdata/error_cause.ts
index 7ebd5a48a..385ce2a03 100644
--- a/cli/tests/testdata/error_cause.ts
+++ b/cli/tests/testdata/error_cause.ts
@@ -1,5 +1,6 @@
function a() {
- throw new Error("foo", { cause: new Error("bar", { cause: "deno" }) });
+ // deno-lint-ignore no-explicit-any
+ throw new Error("foo", { cause: new Error("bar", { cause: "deno" as any }) });
}
function b() {
diff --git a/cli/tests/testdata/error_cause.ts.out b/cli/tests/testdata/error_cause.ts.out
index 155ef656e..0f32b1bdd 100644
--- a/cli/tests/testdata/error_cause.ts.out
+++ b/cli/tests/testdata/error_cause.ts.out
@@ -1,17 +1,17 @@
[WILDCARD]
error: Uncaught Error: foo
- throw new Error("foo", { cause: new Error("bar", { cause: "deno" }) });
+ throw new Error("foo", { cause: new Error("bar", { cause: "deno" as any }) });
^
- at a (file:///[WILDCARD]/error_cause.ts:2:9)
- at b (file:///[WILDCARD]/error_cause.ts:6:3)
- at c (file:///[WILDCARD]/error_cause.ts:10:3)
- at file:///[WILDCARD]/error_cause.ts:13:1
+ at a (file:///[WILDCARD]/error_cause.ts:3:9)
+ at b (file:///[WILDCARD]/error_cause.ts:7:3)
+ at c (file:///[WILDCARD]/error_cause.ts:11:3)
+ at file:///[WILDCARD]/error_cause.ts:14:1
Caused by: Uncaught Error: bar
- throw new Error("foo", { cause: new Error("bar", { cause: "deno" }) });
+ throw new Error("foo", { cause: new Error("bar", { cause: "deno" as any }) });
^
- at a (file:///[WILDCARD]/error_cause.ts:2:35)
- at b (file:///[WILDCARD]/error_cause.ts:6:3)
- at c (file:///[WILDCARD]/error_cause.ts:10:3)
- at file:///[WILDCARD]/error_cause.ts:13:1
+ at a (file:///[WILDCARD]/error_cause.ts:3:35)
+ at b (file:///[WILDCARD]/error_cause.ts:7:3)
+ at c (file:///[WILDCARD]/error_cause.ts:11:3)
+ at file:///[WILDCARD]/error_cause.ts:14:1
Caused by: Uncaught deno
[WILDCARD] \ No newline at end of file
diff --git a/cli/tests/testdata/lsp/code_action_response_imports.json b/cli/tests/testdata/lsp/code_action_response_imports.json
index e4d926bdd..cb1de6d77 100644
--- a/cli/tests/testdata/lsp/code_action_response_imports.json
+++ b/cli/tests/testdata/lsp/code_action_response_imports.json
@@ -1,6 +1,6 @@
[
{
- "title": "Import 'abc' from module \"./file00.ts\"",
+ "title": "Add import from \"./file00.ts\"",
"kind": "quickfix",
"diagnostics": [
{
@@ -120,7 +120,7 @@
}
},
{
- "title": "Import 'def' from module \"./file00.ts\"",
+ "title": "Add import from \"./file00.ts\"",
"kind": "quickfix",
"diagnostics": [
{
diff --git a/cli/tests/testdata/lsp/code_action_response_refactor.json b/cli/tests/testdata/lsp/code_action_response_refactor.json
index a9fbd2827..c2797812e 100644
--- a/cli/tests/testdata/lsp/code_action_response_refactor.json
+++ b/cli/tests/testdata/lsp/code_action_response_refactor.json
@@ -129,8 +129,8 @@
}
},
{
- "title": "Convert named imports to namespace import",
- "kind": "refactor.rewrite.import.namespace",
+ "title": "Convert named imports to default import",
+ "kind": "refactor.rewrite.import.default",
"isPreferred": false,
"disabled": {
"reason": "Selection is not an import declaration."
@@ -148,15 +148,15 @@
}
},
"refactorName": "Convert import",
- "actionName": "Convert named imports to namespace import"
+ "actionName": "Convert named imports to default import"
}
},
{
- "title": "Convert to optional chain expression",
- "kind": "refactor.rewrite.expression.optionalChain",
+ "title": "Convert named imports to namespace import",
+ "kind": "refactor.rewrite.import.namespace",
"isPreferred": false,
"disabled": {
- "reason": "Could not find convertible access expression"
+ "reason": "Selection is not an import declaration."
},
"data": {
"specifier": "file:///a/file.ts",
@@ -170,8 +170,8 @@
"character": 0
}
},
- "refactorName": "Convert to optional chain expression",
- "actionName": "Convert to optional chain expression"
+ "refactorName": "Convert import",
+ "actionName": "Convert named imports to namespace import"
}
}
]
diff --git a/cli/tests/unit/console_test.ts b/cli/tests/unit/console_test.ts
index af78cf49e..97c84b690 100644
--- a/cli/tests/unit/console_test.ts
+++ b/cli/tests/unit/console_test.ts
@@ -1895,6 +1895,7 @@ Deno.test(function inspectErrorCircular() {
cause: new Error("This is a cause error"),
});
error1.cause = error1;
+ assert(error2.cause);
error2.cause.cause = error2;
assertStringIncludes(
diff --git a/cli/tests/unit/esnext_test.ts b/cli/tests/unit/esnext_test.ts
index 4c3c88ac7..dfee67a77 100644
--- a/cli/tests/unit/esnext_test.ts
+++ b/cli/tests/unit/esnext_test.ts
@@ -1,29 +1,15 @@
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
-import { assert, assertEquals } from "./test_util.ts";
+import { assertEquals } from "./test_util.ts";
// TODO(@kitsonk) remove when we are no longer patching TypeScript to have
// these types available.
Deno.test(function typeCheckingEsNextArrayString() {
- const a = "abcdef";
- assertEquals(a.at(-1), "f");
const b = ["a", "b", "c", "d", "e", "f"];
- assertEquals(b.at(-1), "f");
assertEquals(b.findLast((val) => typeof val === "string"), "f");
assertEquals(b.findLastIndex((val) => typeof val === "string"), 5);
});
-Deno.test(function objectHasOwn() {
- const a = { a: 1 };
- assert(Object.hasOwn(a, "a"));
- assert(!Object.hasOwn(a, "b"));
-});
-
-Deno.test(function errorCause() {
- const e = new Error("test", { cause: "something" });
- assertEquals(e.cause, "something");
-});
-
Deno.test(function intlListFormat() {
const formatter = new Intl.ListFormat("en", {
style: "long",