diff options
author | David Sherret <dsherret@users.noreply.github.com> | 2024-09-14 11:58:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-14 11:58:47 +0100 |
commit | af2d992ecd2b9320072164b6ee295c31a3194406 (patch) | |
tree | 0926e2852aa2c4eb300e1f54f4c84d7568589b3b /tests | |
parent | 2c0bf6fd65b3276c4818c73028b19819608c8e70 (diff) |
feat: TypeScript 5.6 and `npm:@types/node@22` (#25614)
Diffstat (limited to 'tests')
20 files changed, 188 insertions, 55 deletions
diff --git a/tests/integration/check_tests.rs b/tests/integration/check_tests.rs index f5af5803c..d3111727c 100644 --- a/tests/integration/check_tests.rs +++ b/tests/integration/check_tests.rs @@ -52,11 +52,6 @@ itest!(check_npm_install_diagnostics { exit_code: 1, }); -itest!(check_export_equals_declaration_file { - args: "check --quiet check/export_equals_declaration_file/main.ts", - exit_code: 0, -}); - itest!(check_static_response_json { args: "check --quiet check/response_json.ts", exit_code: 0, diff --git a/tests/integration/lsp_tests.rs b/tests/integration/lsp_tests.rs index cfd0da840..b6cc71ec6 100644 --- a/tests/integration/lsp_tests.rs +++ b/tests/integration/lsp_tests.rs @@ -5380,7 +5380,7 @@ fn lsp_jsr_auto_import_completion() { json!({ "triggerKind": 1 }), ); assert!(!list.is_incomplete); - assert_eq!(list.items.len(), 267); + assert_eq!(list.items.len(), 268); let item = list.items.iter().find(|i| i.label == "add").unwrap(); assert_eq!(&item.label, "add"); assert_eq!( @@ -5460,7 +5460,7 @@ fn lsp_jsr_auto_import_completion_import_map() { json!({ "triggerKind": 1 }), ); assert!(!list.is_incomplete); - assert_eq!(list.items.len(), 267); + assert_eq!(list.items.len(), 268); 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" })); diff --git a/tests/registry/npm/@types/node/node-22.5.4.tgz b/tests/registry/npm/@types/node/node-22.5.4.tgz Binary files differnew file mode 100644 index 000000000..2a7f1911a --- /dev/null +++ b/tests/registry/npm/@types/node/node-22.5.4.tgz diff --git a/tests/registry/npm/@types/node/registry.json b/tests/registry/npm/@types/node/registry.json index 4bdcd9f52..240ac87c0 100644 --- a/tests/registry/npm/@types/node/registry.json +++ b/tests/registry/npm/@types/node/registry.json @@ -1,17 +1,49 @@ { "name": "@types/node", - "description": "TypeScript definitions for node", "dist-tags": { - "latest": "18.8.2" + "ts4.9": "22.5.4", + "ts5.5": "22.5.4", + "ts5.6": "22.5.4", + "ts5.7": "22.5.4", + "ts4.8": "22.5.4", + "ts5.2": "22.5.4", + "ts5.3": "22.5.4", + "ts5.4": "22.5.4", + "ts5.1": "22.5.4", + "ts5.0": "22.5.4", + "latest": "22.5.4" }, "versions": { "18.8.2": { "name": "@types/node", "version": "18.8.2", - "description": "TypeScript definitions for Node.js", "license": "MIT", + "_id": "@types/node@18.8.2", + "dist": { + "shasum": "17d42c6322d917764dd3d2d3a10d7884925de067", + "tarball": "http://localhost:4260/@types/node/node-18.8.2.tgz", + "fileCount": 124, + "integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==", + "signatures": [ + { + "sig": "MEYCIQCAqI3XibndhBD647C/13AFb58Fhmg4WmfCoGrIYrgtzwIhAIB0b0D58Tigwb3qKaOVsKnuYOOr0strAmprZSCi/+oq", + "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA" + } + ], + "unpackedSize": 3524549, + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjPFItACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrKAg/+IwaUWPgePlO4IxW7CVhFEEFiyhjEH3FHe0ogC3YmreoBFv/A\r\nPwQrwObdskbGWrBzsAOVFvhzYktzP3kc857HtU2ia9FXeaEYvsSQBqh6jZfA\r\njR1+h+jn+W5JnmbnwRGfNn2riCo/un4tYoZ4o/bKiMdNd9WrdIs0Oii1Dd4N\r\nnsBXPb05UPPP4Uu8cz68u1bj+QQ6aslr6keGNyNeILf8bJsEfcfVkEO3l4cu\r\njyTIrxiD+tM8jrUE9CDeodF8CZNuvLh3hqdMPJeH3U47qkDtPDKEOvZTbyYm\r\ngodto6mcnuBr8F9vmikAQfGiXV0U2cg2XRjWc1lI8HT4X0kESTIo+nzNuliD\r\niTpfjyZHdKBGGIuHP1Ou9dVvx4t5XZ1JsK9EK5WTilvAlu/qZrynxXxAV3Rc\r\nvL9UhIacISprMWB3Sohl9ZtfcmGnV/KMRpM+yPZOWp39gQQCKaKF/j2f/mir\r\n8YFbFUnySZkXKzxgsgjrSsh9QiK2dYAzcqHlazITeFN9jOYRzYUjAFj3qOFm\r\n7o1eJpW0qM5vgR+fPq30WxcdcQ4PaWgHSlb/ll8hiwQG1ZUihO/1RU7FtDoc\r\n1KwcfrGOAJPL6vBSLPReUkhDIUTSBwfmvfMxzqD1aDp6YV5WX7h03B0dWbPJ\r\nmPJmJZjjZje4Trk9jBJ5/ZLpB8/zkrDKvhE=\r\n=LPWa\r\n-----END PGP SIGNATURE-----\r\n" + }, "main": "", "types": "index.d.ts", + "scripts": {}, + "repository": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "type": "git", + "directory": "types/node" + }, + "description": "TypeScript definitions for Node.js", + "directories": {}, + "dependencies": {}, "typesVersions": { "<4.9.0-0": { "*": [ @@ -19,33 +51,39 @@ ] } }, - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/node" - }, - "scripts": {}, - "dependencies": {}, - "typesPublisherContentHash": "034172ea945b66afc6502e6be34d6fb957c596091e39cf43672e8aca563a8c66", + "_hasShrinkwrap": false, "typeScriptVersion": "4.1", - "_id": "@types/node@18.8.2", - "dist": { - "integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==", - "shasum": "17d42c6322d917764dd3d2d3a10d7884925de067", - "tarball": "http://localhost:4260/@types/node/node-18.8.2.tgz", - "fileCount": 124, - "unpackedSize": 3524549 - }, - "directories": {}, - "_hasShrinkwrap": false + "typesPublisherContentHash": "034172ea945b66afc6502e6be34d6fb957c596091e39cf43672e8aca563a8c66" }, "18.16.19": { "name": "@types/node", "version": "18.16.19", - "description": "TypeScript definitions for Node.js", "license": "MIT", + "_id": "@types/node@18.16.19", + "dist": { + "shasum": "cb03fca8910fdeb7595b755126a8a78144714eea", + "tarball": "http://localhost:4260/@types/node/node-18.16.19.tgz", + "fileCount": 125, + "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", + "signatures": [ + { + "sig": "MEYCIQCrmUK+J0P1ywi+U/RBUqMXSK7c0kDYxMEYunkXNSPf+wIhANTRnqmuKWdzIKhsGHCZB+js8qhLcce/P+XOR1JmSNIc", + "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA" + } + ], + "unpackedSize": 3677153 + }, "main": "", "types": "index.d.ts", + "scripts": {}, + "repository": { + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "type": "git", + "directory": "types/node" + }, + "description": "TypeScript definitions for Node.js", + "directories": {}, + "dependencies": {}, "typesVersions": { "<=4.8": { "*": [ @@ -53,33 +91,54 @@ ] } }, + "_hasShrinkwrap": false, + "typeScriptVersion": "4.3", + "typesPublisherContentHash": "e0763594b4075c74150a6024cd39f92797ea5c273540e3a5fe0a63a791ffa0c8" + }, + "22.5.4": { + "name": "@types/node", + "version": "22.5.4", + "license": "MIT", + "_id": "@types/node@22.5.4", + "dist": { + "shasum": "83f7d1f65bc2ed223bdbf57c7884f1d5a4fa84e8", + "tarball": "http://localhost:4260/@types/node/node-22.5.4.tgz", + "fileCount": 66, + "integrity": "sha512-FDuKUJQm/ju9fT/SeX/6+gBzoPzlVCzfzmGkwKvRHQVxi4BntVbyIwf6a4Xn62mrvndLiml6z/UBXIdEVjQLXg==", + "signatures": [ + { + "sig": "MEQCIBbWAo9Soe8vwExWQDxwtbCM6CdXy4QChOKJVJSoNpNiAiBfaOBNxW/iDfPEGn6WQ/wZggtMCAdZNLbVBfSynJ/pdA==", + "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA" + } + ], + "unpackedSize": 2203331 + }, + "main": "", + "types": "index.d.ts", + "scripts": {}, "repository": { - "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "type": "git", "directory": "types/node" }, - "scripts": {}, - "dependencies": {}, - "typesPublisherContentHash": "e0763594b4075c74150a6024cd39f92797ea5c273540e3a5fe0a63a791ffa0c8", - "typeScriptVersion": "4.3", - "_id": "@types/node@18.16.19", - "dist": { - "integrity": "sha512-IXl7o+R9iti9eBW4Wg2hx1xQDig183jj7YLn8F7udNceyfkbn1ZxmzZXuak20gR40D7pIkIY1kYGx5VIGbaHKA==", - "shasum": "cb03fca8910fdeb7595b755126a8a78144714eea", - "tarball": "http://localhost:4260/@types/node/node-18.16.19.tgz", - "fileCount": 125, - "unpackedSize": 3677153 - }, + "description": "TypeScript definitions for node", "directories": {}, - "_hasShrinkwrap": false + "dependencies": { + "undici-types": "~6.19.2" + }, + "_hasShrinkwrap": false, + "typeScriptVersion": "4.8", + "typesPublisherContentHash": "6ee9a11eba834031423800320320aa873d6bf2b6f33603c13a2aa9d90b3803ee" } }, "license": "MIT", - "readmeFilename": "", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", "repository": { - "type": "git", "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "type": "git", "directory": "types/node" }, - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node" -} + "description": "TypeScript definitions for node", + "readme": "[object Object]", + "readmeFilename": "" +}
\ No newline at end of file diff --git a/tests/registry/npm/trim_registry_files.js b/tests/registry/npm/trim_registry_files.js index 608624b1d..608624b1d 100755..100644 --- a/tests/registry/npm/trim_registry_files.js +++ b/tests/registry/npm/trim_registry_files.js diff --git a/tests/registry/npm/undici-types/registry.json b/tests/registry/npm/undici-types/registry.json new file mode 100644 index 000000000..fbe9d67af --- /dev/null +++ b/tests/registry/npm/undici-types/registry.json @@ -0,0 +1,53 @@ +{ + "name": "undici-types", + "dist-tags": { + "latest": "6.19.8" + }, + "versions": { + "6.19.8": { + "name": "undici-types", + "version": "6.19.8", + "description": "A stand-alone types package for Undici", + "bugs": { + "url": "https://github.com/nodejs/undici/issues" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/nodejs/undici.git" + }, + "license": "MIT", + "types": "index.d.ts", + "_id": "undici-types@6.19.8", + "gitHead": "3d3ce0695c8c3f9a8f3c8af90dd42d0569d3f0bb", + "_nodeVersion": "20.16.0", + "_npmVersion": "10.8.1", + "dist": { + "integrity": "sha512-ve2KP6f/JnbPBFyobGHuerC9g1FYGn/F8n1LWTwNxCEzd6IfqTwUQcNXgEtmmQ6DlRrC1hrSrBnCZPokRrDHjw==", + "shasum": "35111c9d1437ab83a7cdc0abae2f26d88eda0a02", + "tarball": "http://localhost:4260/undici-types/undici-types-6.19.8.tgz", + "fileCount": 41, + "unpackedSize": 84225, + "signatures": [ + { + "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA", + "sig": "MEUCIGHm3RU6nmPjpFrE7lus7cMT9nBeVHOhTWjzflE57x08AiEAs6/KJsXAnqL1KXWZBAkJ5Gf4NdDUqZcjr/OL+clXX3I=" + } + ] + }, + "directories": {}, + "_hasShrinkwrap": false + } + }, + "bugs": { + "url": "https://github.com/nodejs/undici/issues" + }, + "license": "MIT", + "homepage": "https://undici.nodejs.org", + "repository": { + "type": "git", + "url": "git+https://github.com/nodejs/undici.git" + }, + "description": "A stand-alone types package for Undici", + "readme": "# undici-types\n\nThis package is a dual-publish of the [undici](https://www.npmjs.com/package/undici) library types. The `undici` package **still contains types**. This package is for users who _only_ need undici types (such as for `@types/node`). It is published alongside every release of `undici`, so you can always use the same version.\n\n- [GitHub nodejs/undici](https://github.com/nodejs/undici)\n- [Undici Documentation](https://undici.nodejs.org/#/)\n", + "readmeFilename": "README.md" +} diff --git a/tests/registry/npm/undici-types/undici-types-6.19.8.tgz b/tests/registry/npm/undici-types/undici-types-6.19.8.tgz Binary files differnew file mode 100644 index 000000000..3fe4b9b9d --- /dev/null +++ b/tests/registry/npm/undici-types/undici-types-6.19.8.tgz diff --git a/tests/specs/check/export_equals_declaration_file/__test__.jsonc b/tests/specs/check/export_equals_declaration_file/__test__.jsonc new file mode 100644 index 000000000..d69543a47 --- /dev/null +++ b/tests/specs/check/export_equals_declaration_file/__test__.jsonc @@ -0,0 +1,10 @@ +{ + "steps": [{ + "args": "check main.ts", + "output": "main.out" + }, { + // ensure diagnostic is not cached + "args": "check main.ts", + "output": "main.out" + }] +} diff --git a/tests/specs/check/export_equals_declaration_file/main.out b/tests/specs/check/export_equals_declaration_file/main.out new file mode 100644 index 000000000..70b7d2fe6 --- /dev/null +++ b/tests/specs/check/export_equals_declaration_file/main.out @@ -0,0 +1,6 @@ +Check file:///[WILDLINE]/main.ts +TS1203 [WARN]: Export assignment cannot be used when targeting ECMAScript modules. Consider using 'export default' or another module format instead. This will start erroring in a future version of Deno 2 in order to align with TypeScript. +export = other; +~~~~~~~~~~~~~~~ + at file:///[WILDLINE]/other.d.ts:1:1 + diff --git a/tests/testdata/check/export_equals_declaration_file/main.ts b/tests/specs/check/export_equals_declaration_file/main.ts index e20a735d5..e20a735d5 100644 --- a/tests/testdata/check/export_equals_declaration_file/main.ts +++ b/tests/specs/check/export_equals_declaration_file/main.ts diff --git a/tests/testdata/check/export_equals_declaration_file/other.d.ts b/tests/specs/check/export_equals_declaration_file/other.d.ts index 5e1274fa5..5e1274fa5 100644 --- a/tests/testdata/check/export_equals_declaration_file/other.d.ts +++ b/tests/specs/check/export_equals_declaration_file/other.d.ts diff --git a/tests/testdata/check/export_equals_declaration_file/other.js b/tests/specs/check/export_equals_declaration_file/other.js index f66c03162..f66c03162 100644 --- a/tests/testdata/check/export_equals_declaration_file/other.js +++ b/tests/specs/check/export_equals_declaration_file/other.js diff --git a/tests/specs/publish/bare_node_builtins/bare_node_builtins.out b/tests/specs/publish/bare_node_builtins/bare_node_builtins.out index 2a12eb6de..36ba9c7ce 100644 --- a/tests/specs/publish/bare_node_builtins/bare_node_builtins.out +++ b/tests/specs/publish/bare_node_builtins/bare_node_builtins.out @@ -1,7 +1,11 @@ Warning Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix. Warning Resolving "url" as "node:url" at file:///[WILDLINE]/mod.ts:1:22. If you want to use a built-in Node module, add a "node:" prefix. +[UNORDERED_START] Download http://localhost:4260/@types/node -Download http://localhost:4260/@types/node/node-18.16.19.tgz +Download http://localhost:4260/undici-types +Download http://localhost:4260/@types/node/node-22.5.4.tgz +Download http://localhost:4260/undici-types/undici-types-6.19.8.tgz +[UNORDERED_END] Check file:///[WILDLINE]/mod.ts Checking for slow types in the public API... Check file:///[WILDLINE]/mod.ts diff --git a/tests/specs/publish/node_specifier/node_specifier.out b/tests/specs/publish/node_specifier/node_specifier.out index 3c0bc48d8..4c9d7cb3e 100644 --- a/tests/specs/publish/node_specifier/node_specifier.out +++ b/tests/specs/publish/node_specifier/node_specifier.out @@ -1,5 +1,9 @@ +[UNORDERED_START] Download http://localhost:4260/@types/node -Download http://localhost:4260/@types/node/node-[WILDCARD].tgz +Download http://localhost:4260/undici-types +Download http://localhost:4260/@types/node/node-22.5.4.tgz +Download http://localhost:4260/undici-types/undici-types-6.19.8.tgz +[UNORDERED_END] Check file:///[WILDCARD]/mod.ts Checking for slow types in the public API... Check file:///[WILDCARD]/publish/node_specifier/mod.ts diff --git a/tests/testdata/npm/compare_globals/main.out b/tests/testdata/npm/compare_globals/main.out index f6f90d533..234a68971 100644 --- a/tests/testdata/npm/compare_globals/main.out +++ b/tests/testdata/npm/compare_globals/main.out @@ -1,10 +1,12 @@ [UNORDERED_START] Download http://localhost:4260/@types/node +Download http://localhost:4260/undici-types Download http://localhost:4260/@denotest/globals [UNORDERED_END] [UNORDERED_START] Download http://localhost:4260/@denotest/globals/1.0.0.tgz -Download http://localhost:4260/@types/node/node-18.16.19.tgz +Download http://localhost:4260/@types/node/node-22.5.4.tgz +Download http://localhost:4260/undici-types/undici-types-6.19.8.tgz [UNORDERED_END] Check file:///[WILDCARD]/npm/compare_globals/main.ts true diff --git a/tests/unit/version_test.ts b/tests/unit/version_test.ts index 96319c630..307295ad8 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.5.2"); + assertEquals(Deno.version.typescript, "5.6.2"); }); diff --git a/tests/unit_node/_fs/_fs_stat_test.ts b/tests/unit_node/_fs/_fs_stat_test.ts index 09d78f9db..02c620e2d 100644 --- a/tests/unit_node/_fs/_fs_stat_test.ts +++ b/tests/unit_node/_fs/_fs_stat_test.ts @@ -133,7 +133,9 @@ Deno.test("[std/node/fs] stat callback isn't called twice if error is thrown", a Deno.test({ name: "[std/node/fs] stat default methods", fn() { - const stats = new Stats(); + // stats ctor is private + // deno-lint-ignore no-explicit-any + const stats = new (Stats as any)(); assertEquals(stats.isFile(), false); assertEquals(stats.isDirectory(), false); assertEquals(stats.isBlockDevice(), false); diff --git a/tests/unit_node/child_process_test.ts b/tests/unit_node/child_process_test.ts index 7e6977740..f776fa4ac 100644 --- a/tests/unit_node/child_process_test.ts +++ b/tests/unit_node/child_process_test.ts @@ -12,7 +12,7 @@ import { assertThrows, } from "@std/assert"; import * as path from "@std/path"; -import { setTimeout } from "node:timers"; +import { clearTimeout, setTimeout } from "node:timers"; const { spawn, spawnSync, execFile, execFileSync, ChildProcess } = CP; diff --git a/tests/unit_node/events_test.ts b/tests/unit_node/events_test.ts index 82808d523..8cfef6319 100644 --- a/tests/unit_node/events_test.ts +++ b/tests/unit_node/events_test.ts @@ -1,6 +1,5 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -// @ts-expect-error: @types/node is outdated import events, { addAbortListener, EventEmitter } from "node:events"; EventEmitter.captureRejections = true; diff --git a/tests/unit_node/stream_test.ts b/tests/unit_node/stream_test.ts index 0aa2de18c..b8542f6cf 100644 --- a/tests/unit_node/stream_test.ts +++ b/tests/unit_node/stream_test.ts @@ -3,7 +3,6 @@ import { assert, assertEquals } from "@std/assert"; import { fromFileUrl, relative } from "@std/path"; import { pipeline } from "node:stream/promises"; -// @ts-expect-error: @types/node is outdated import { getDefaultHighWaterMark, Stream } from "node:stream"; import { createReadStream, createWriteStream } from "node:fs"; import { EventEmitter } from "node:events"; |