diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-03-26 18:52:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-26 18:52:57 -0400 |
commit | ac4a5f74b8e56a360e0a0543a6fc45099e13b95a (patch) | |
tree | 463796fb830eae41fc039512bb1ce79919195735 /tests | |
parent | 6b95c53e48a2622f4f2b6fdfa6c2c26dc30bbba4 (diff) |
feat: TypeScript 5.4 (#23086)
Fork PR: https://github.com/denoland/TypeScript/pull/10
Closes #23080
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration/lsp_tests.rs | 30 | ||||
-rw-r--r-- | tests/specs/check/cjs_default_export/__test__.jsonc | 6 | ||||
-rw-r--r-- | tests/specs/check/cjs_default_export/main.out | 7 | ||||
-rw-r--r-- | tests/specs/check/cjs_default_export/main.ts | 4 | ||||
-rw-r--r-- | tests/unit/version_test.ts | 2 | ||||
-rw-r--r-- | tests/unit_node/punycode_test.ts | 2 |
6 files changed, 42 insertions, 9 deletions
diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index 61b1d1bd1..9ddaebc59 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -2688,7 +2688,7 @@ fn lsp_hover_jsdoc_symbol_link() { "language": "typescript", "value": "function a(): void" }, - "JSDoc [hello](file:///a/file.ts#L1,10) and [`b`](file:///a/file.ts#L5,7)" + "JSDoc [hello](file:///a/b.ts#L1,1) and [`b`](file:///a/file.ts#L5,7)" ], "range": { "start": { "line": 7, "character": 9 }, @@ -5050,7 +5050,7 @@ fn lsp_jsr_auto_import_completion() { json!({ "triggerKind": 1 }), ); assert!(!list.is_incomplete); - assert_eq!(list.items.len(), 261); + assert_eq!(list.items.len(), 262); let item = list.items.iter().find(|i| i.label == "add").unwrap(); assert_eq!(&item.label, "add"); assert_eq!( @@ -5130,7 +5130,7 @@ fn lsp_jsr_auto_import_completion_import_map() { json!({ "triggerKind": 1 }), ); assert!(!list.is_incomplete); - assert_eq!(list.items.len(), 261); + assert_eq!(list.items.len(), 262); let item = list.items.iter().find(|i| i.label == "add").unwrap(); assert_eq!(&item.label, "add"); assert_eq!(json!(&item.label_details), json!({ "description": "add" })); @@ -7648,7 +7648,18 @@ fn lsp_completions_npm() { ] }), ); - client.read_diagnostics(); + let diagnostics = client.read_diagnostics(); + assert_eq!( + diagnostics + .all() + .iter() + .map(|d| d.message.as_str()) + .collect::<Vec<_>>(), + vec![ + "'chalk' is declared but its value is never read.", + "Identifier expected." + ] + ); let list = client.get_completion_list( "file:///a/file.ts", @@ -7659,9 +7670,14 @@ fn lsp_completions_npm() { }), ); assert!(!list.is_incomplete); - assert_eq!(list.items.len(), 3); - assert!(list.items.iter().any(|i| i.label == "default")); - assert!(list.items.iter().any(|i| i.label == "MyClass")); + assert_eq!( + list + .items + .iter() + .map(|i| i.label.as_str()) + .collect::<Vec<_>>(), + vec!["default", "MyClass", "named"] + ); let res = client.write_request( "completionItem/resolve", diff --git a/tests/specs/check/cjs_default_export/__test__.jsonc b/tests/specs/check/cjs_default_export/__test__.jsonc new file mode 100644 index 000000000..852942826 --- /dev/null +++ b/tests/specs/check/cjs_default_export/__test__.jsonc @@ -0,0 +1,6 @@ +{ + "base": "npm", + "args": "check main.ts", + "output": "main.out", + "exitCode": 1 +} diff --git a/tests/specs/check/cjs_default_export/main.out b/tests/specs/check/cjs_default_export/main.out new file mode 100644 index 000000000..204488273 --- /dev/null +++ b/tests/specs/check/cjs_default_export/main.out @@ -0,0 +1,7 @@ +Download http://localhost:4545/npm/registry/@denotest/cjs-default-export +Download http://localhost:4545/npm/registry/@denotest/cjs-default-export/1.0.0.tgz +Check file:///[WILDCARD]/main.ts +error: TS2322 [ERROR]: Type 'number' is not assignable to type 'string'. +export const Test: string = cjsDefault.default(); + ~~~~ + at file:///[WILDCARD]/main.ts:4:14 diff --git a/tests/specs/check/cjs_default_export/main.ts b/tests/specs/check/cjs_default_export/main.ts new file mode 100644 index 000000000..20a78f6d3 --- /dev/null +++ b/tests/specs/check/cjs_default_export/main.ts @@ -0,0 +1,4 @@ +import cjsDefault from "npm:@denotest/cjs-default-export"; + +// should error since cjsDefault.default() is a number +export const Test: string = cjsDefault.default(); diff --git a/tests/unit/version_test.ts b/tests/unit/version_test.ts index 4eadb7620..daed9fda6 100644 --- a/tests/unit/version_test.ts +++ b/tests/unit/version_test.ts @@ -6,5 +6,5 @@ Deno.test(function version() { const pattern = /^\d+\.\d+\.\d+/; assert(pattern.test(Deno.version.deno)); assert(pattern.test(Deno.version.v8)); - assertEquals(Deno.version.typescript, "5.3.3"); + assertEquals(Deno.version.typescript, "5.4.3"); }); diff --git a/tests/unit_node/punycode_test.ts b/tests/unit_node/punycode_test.ts index f5f8c4f97..baf1b57f6 100644 --- a/tests/unit_node/punycode_test.ts +++ b/tests/unit_node/punycode_test.ts @@ -4,7 +4,7 @@ import * as punycode from "node:punycode"; import { assertEquals } from "@std/assert/mod.ts"; Deno.test("regression #19214", () => { - const input = "个��.hk"; + const input = "个\uFFFD\uFFFD.hk"; assertEquals(punycode.toASCII(input), "xn--ciq6844ba.hk"); |