diff options
author | Kitson Kelly <me@kitsonkelly.com> | 2021-12-10 09:12:21 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-10 09:12:21 +1100 |
commit | 345f0fbe5cdaa71af067c7072537f1823fe4ada5 (patch) | |
tree | c37062607fe23ef9d1826c1d43a10a712b827f3c /cli/tests | |
parent | a3d024ac2ec8d73f7bf268823866d2342d1c1eb1 (diff) |
feat(cli): update to TypeScript 4.5 (#12410)
Co-authored-by: Bartek IwaĆczuk <biwanczuk@gmail.com>
Diffstat (limited to 'cli/tests')
-rw-r--r-- | cli/tests/integration/run_tests.rs | 30 | ||||
-rw-r--r-- | cli/tests/testdata/034_onload/imported.ts | 1 | ||||
-rw-r--r-- | cli/tests/testdata/034_onload/main.ts | 1 | ||||
-rw-r--r-- | cli/tests/testdata/034_onload/nest_imported.ts | 1 | ||||
-rw-r--r-- | cli/tests/testdata/058_tasks_microtasks_close.ts | 1 | ||||
-rw-r--r-- | cli/tests/testdata/import_type.ts | 5 | ||||
-rw-r--r-- | cli/tests/testdata/import_type.ts.out | 2 | ||||
-rw-r--r-- | cli/tests/testdata/lsp/a.d.ts | 1 | ||||
-rw-r--r-- | cli/tests/testdata/lsp/b.d.ts | 1 | ||||
-rw-r--r-- | cli/tests/testdata/mts_dmts_mjs.out | 2 | ||||
-rw-r--r-- | cli/tests/testdata/private_field_presence.ts | 20 | ||||
-rw-r--r-- | cli/tests/testdata/private_field_presence.ts.out | 3 | ||||
-rw-r--r-- | cli/tests/testdata/subdir/export_types.ts | 11 | ||||
-rw-r--r-- | cli/tests/testdata/subdir/import.mts | 4 | ||||
-rw-r--r-- | cli/tests/testdata/subdir/mod.mjs | 1 | ||||
-rw-r--r-- | cli/tests/testdata/subdir/types.d.mts | 1 | ||||
-rw-r--r-- | cli/tests/testdata/subdir/types.d.ts | 1 | ||||
-rw-r--r-- | cli/tests/unit/version_test.ts | 3 |
18 files changed, 88 insertions, 1 deletions
diff --git a/cli/tests/integration/run_tests.rs b/cli/tests/integration/run_tests.rs index 33ca787d9..fbdc01ad7 100644 --- a/cli/tests/integration/run_tests.rs +++ b/cli/tests/integration/run_tests.rs @@ -563,6 +563,26 @@ itest!(fetch_response_finalization { exit_code: 0, }); +itest!(import_type { + args: "run --reload import_type.ts", + output: "import_type.ts.out", +}); + +itest!(import_type_no_check { + args: "run --reload --no-check import_type.ts", + output: "import_type.ts.out", +}); + +itest!(private_field_presence { + args: "run --reload private_field_presence.ts", + output: "private_field_presence.ts.out", +}); + +itest!(private_field_presence_no_check { + args: "run --reload --no-check private_field_presence.ts", + output: "private_field_presence.ts.out", +}); + itest!(lock_write_requires_lock { args: "run --lock-write some_file.ts", output: "lock_write_requires_lock.out", @@ -611,6 +631,16 @@ itest!(lock_check_err2 { http_server: true, }); +itest!(mts_dmts_mjs { + args: "run subdir/import.mts", + output: "mts_dmts_mjs.out", +}); + +itest!(mts_dmts_mjs_no_check { + args: "run --no-check subdir/import.mts", + output: "mts_dmts_mjs.out", +}); + itest!(async_error { exit_code: 1, args: "run --reload async_error.ts", diff --git a/cli/tests/testdata/034_onload/imported.ts b/cli/tests/testdata/034_onload/imported.ts index bac6cf5fa..a176d4200 100644 --- a/cli/tests/testdata/034_onload/imported.ts +++ b/cli/tests/testdata/034_onload/imported.ts @@ -1,3 +1,4 @@ +// deno-lint-ignore-file no-window-prefix import { assert } from "../../../../test_util/std/testing/asserts.ts"; import "./nest_imported.ts"; diff --git a/cli/tests/testdata/034_onload/main.ts b/cli/tests/testdata/034_onload/main.ts index 42df21c16..df6713105 100644 --- a/cli/tests/testdata/034_onload/main.ts +++ b/cli/tests/testdata/034_onload/main.ts @@ -1,3 +1,4 @@ +// deno-lint-ignore-file no-window-prefix no-prototype-builtins import { assert } from "../../../../test_util/std/testing/asserts.ts"; import "./imported.ts"; diff --git a/cli/tests/testdata/034_onload/nest_imported.ts b/cli/tests/testdata/034_onload/nest_imported.ts index 259e505a2..e461dd9b1 100644 --- a/cli/tests/testdata/034_onload/nest_imported.ts +++ b/cli/tests/testdata/034_onload/nest_imported.ts @@ -1,3 +1,4 @@ +// deno-lint-ignore-file no-window-prefix import { assert } from "../../../../test_util/std/testing/asserts.ts"; const handler = (e: Event) => { diff --git a/cli/tests/testdata/058_tasks_microtasks_close.ts b/cli/tests/testdata/058_tasks_microtasks_close.ts index 11de55a38..38e156044 100644 --- a/cli/tests/testdata/058_tasks_microtasks_close.ts +++ b/cli/tests/testdata/058_tasks_microtasks_close.ts @@ -1,3 +1,4 @@ +// deno-lint-ignore-file no-window-prefix console.log("sync 1"); setTimeout(() => { console.log("setTimeout 1"); diff --git a/cli/tests/testdata/import_type.ts b/cli/tests/testdata/import_type.ts new file mode 100644 index 000000000..851ebad86 --- /dev/null +++ b/cli/tests/testdata/import_type.ts @@ -0,0 +1,5 @@ +import { type B, create } from "./subdir/export_types.ts"; + +const b: B = create(); + +console.log(b); diff --git a/cli/tests/testdata/import_type.ts.out b/cli/tests/testdata/import_type.ts.out new file mode 100644 index 000000000..188c5e25d --- /dev/null +++ b/cli/tests/testdata/import_type.ts.out @@ -0,0 +1,2 @@ +[WILDCARD] +B { a: "a" } diff --git a/cli/tests/testdata/lsp/a.d.ts b/cli/tests/testdata/lsp/a.d.ts index 7f587e144..536a6d0a6 100644 --- a/cli/tests/testdata/lsp/a.d.ts +++ b/cli/tests/testdata/lsp/a.d.ts @@ -1 +1,2 @@ +// deno-lint-ignore-file no-var declare var a: string; diff --git a/cli/tests/testdata/lsp/b.d.ts b/cli/tests/testdata/lsp/b.d.ts index 9d4b96cb8..2fd56623b 100644 --- a/cli/tests/testdata/lsp/b.d.ts +++ b/cli/tests/testdata/lsp/b.d.ts @@ -1 +1,2 @@ +// deno-lint-ignore-file no-var declare var b: string; diff --git a/cli/tests/testdata/mts_dmts_mjs.out b/cli/tests/testdata/mts_dmts_mjs.out new file mode 100644 index 000000000..5647bdfb9 --- /dev/null +++ b/cli/tests/testdata/mts_dmts_mjs.out @@ -0,0 +1,2 @@ +[WILDCARD] +a diff --git a/cli/tests/testdata/private_field_presence.ts b/cli/tests/testdata/private_field_presence.ts new file mode 100644 index 000000000..7ce2840d8 --- /dev/null +++ b/cli/tests/testdata/private_field_presence.ts @@ -0,0 +1,20 @@ +export class Person { + #name: string; + constructor(name: string) { + this.#name = name; + } + + equals(other: unknown) { + return other && + typeof other === "object" && + #name in other && + this.#name === other.#name; + } +} + +const a = new Person("alice"); +const b = new Person("bob"); +const c = new Person("alice"); + +console.log(a.equals(b)); +console.log(a.equals(c)); diff --git a/cli/tests/testdata/private_field_presence.ts.out b/cli/tests/testdata/private_field_presence.ts.out new file mode 100644 index 000000000..f582fb47a --- /dev/null +++ b/cli/tests/testdata/private_field_presence.ts.out @@ -0,0 +1,3 @@ +[WILDCARD] +false +true diff --git a/cli/tests/testdata/subdir/export_types.ts b/cli/tests/testdata/subdir/export_types.ts new file mode 100644 index 000000000..18c8ed881 --- /dev/null +++ b/cli/tests/testdata/subdir/export_types.ts @@ -0,0 +1,11 @@ +export interface A { + a: string; +} + +export class B implements A { + a = "a"; +} + +export function create(): B { + return new B(); +} diff --git a/cli/tests/testdata/subdir/import.mts b/cli/tests/testdata/subdir/import.mts new file mode 100644 index 000000000..eeb200f59 --- /dev/null +++ b/cli/tests/testdata/subdir/import.mts @@ -0,0 +1,4 @@ +import * as a from "./mod.mjs"; +import { type A } from "./types.d.mts"; + +console.log(a.a as A); diff --git a/cli/tests/testdata/subdir/mod.mjs b/cli/tests/testdata/subdir/mod.mjs new file mode 100644 index 000000000..9233cce2f --- /dev/null +++ b/cli/tests/testdata/subdir/mod.mjs @@ -0,0 +1 @@ +export const a = "a"; diff --git a/cli/tests/testdata/subdir/types.d.mts b/cli/tests/testdata/subdir/types.d.mts new file mode 100644 index 000000000..28c282146 --- /dev/null +++ b/cli/tests/testdata/subdir/types.d.mts @@ -0,0 +1 @@ +export type A = "a"; diff --git a/cli/tests/testdata/subdir/types.d.ts b/cli/tests/testdata/subdir/types.d.ts index 7f587e144..536a6d0a6 100644 --- a/cli/tests/testdata/subdir/types.d.ts +++ b/cli/tests/testdata/subdir/types.d.ts @@ -1 +1,2 @@ +// deno-lint-ignore-file no-var declare var a: string; diff --git a/cli/tests/unit/version_test.ts b/cli/tests/unit/version_test.ts index 6da4fd684..4f8a1c5e4 100644 --- a/cli/tests/unit/version_test.ts +++ b/cli/tests/unit/version_test.ts @@ -8,6 +8,7 @@ Deno.test(function version() { assert( pattern.test(Deno.version.typescript) || Deno.version.typescript === "0-dev" || - Deno.version.typescript === "0-beta", + Deno.version.typescript === "0-beta" || + Deno.version.typescript === "1-rc", ); }); |