From bcfe279fba865763c87f9cd8d5a2d0b2cbf451be Mon Sep 17 00:00:00 2001 From: David Sherret Date: Fri, 21 Oct 2022 11:20:18 -0400 Subject: feat(unstable/npm): initial type checking of npm specifiers (#16332) --- cli/tests/testdata/npm/compare_globals/main.js | 2 -- cli/tests/testdata/npm/compare_globals/main.out | 5 +++++ cli/tests/testdata/npm/compare_globals/main.ts | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 2 deletions(-) delete mode 100644 cli/tests/testdata/npm/compare_globals/main.js create mode 100644 cli/tests/testdata/npm/compare_globals/main.ts (limited to 'cli/tests/testdata/npm/compare_globals') diff --git a/cli/tests/testdata/npm/compare_globals/main.js b/cli/tests/testdata/npm/compare_globals/main.js deleted file mode 100644 index ce43e32b1..000000000 --- a/cli/tests/testdata/npm/compare_globals/main.js +++ /dev/null @@ -1,2 +0,0 @@ -import * as globals from "npm:@denotest/globals"; -console.log(globals.global === globals.globalThis); diff --git a/cli/tests/testdata/npm/compare_globals/main.out b/cli/tests/testdata/npm/compare_globals/main.out index a1a5c0e8f..1b22fd318 100644 --- a/cli/tests/testdata/npm/compare_globals/main.out +++ b/cli/tests/testdata/npm/compare_globals/main.out @@ -1,3 +1,8 @@ Download http://localhost:4545/npm/registry/@denotest/globals +Download http://localhost:4545/npm/registry/@types/node Download http://localhost:4545/npm/registry/@denotest/globals/1.0.0.tgz +Download http://localhost:4545/npm/registry/@types/node/node-18.8.2.tgz +Check file:///[WILDCARD]/npm/compare_globals/main.ts +Check file:///[WILDCARD]/std/node/module_all.ts true +[] diff --git a/cli/tests/testdata/npm/compare_globals/main.ts b/cli/tests/testdata/npm/compare_globals/main.ts new file mode 100644 index 000000000..5710d0bd5 --- /dev/null +++ b/cli/tests/testdata/npm/compare_globals/main.ts @@ -0,0 +1,14 @@ +/// + +import * as globals from "npm:@denotest/globals"; +console.log(globals.global === globals.globalThis); +console.log(globals.process.execArgv); + +type AssertTrue = never; +type _TestNoProcessGlobal = AssertTrue< + typeof globalThis extends { process: any } ? false : true +>; +type _TestHasNodeJsGlobal = NodeJS.Architecture; + +const controller = new AbortController(); +controller.abort("reason"); // in the NodeJS declaration it doesn't have a reason -- cgit v1.2.3