From 9b324b1cf4a8ee4159abb041e72a8885a28e92a3 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Fri, 26 Aug 2022 23:39:05 +0900 Subject: fix(ext/node): fix global in node env (#15622) --- cli/tests/integration/npm_tests.rs | 7 +++++++ cli/tests/testdata/npm/compare_globals/main.js | 2 ++ cli/tests/testdata/npm/compare_globals/main.out | 3 +++ .../registry/@denotest/cjs-local-global-decls/1.0.0/package.json | 2 +- cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.js | 2 ++ .../testdata/npm/registry/@denotest/globals/1.0.0/package.json | 4 ++++ 6 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 cli/tests/testdata/npm/compare_globals/main.js create mode 100644 cli/tests/testdata/npm/compare_globals/main.out create mode 100644 cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.js create mode 100644 cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/package.json (limited to 'cli') diff --git a/cli/tests/integration/npm_tests.rs b/cli/tests/integration/npm_tests.rs index 582284c36..6e47da8f6 100644 --- a/cli/tests/integration/npm_tests.rs +++ b/cli/tests/integration/npm_tests.rs @@ -54,6 +54,13 @@ itest!(cjs_local_global_decls { http_server: true, }); +itest!(compare_globals { + args: "run --allow-read --unstable npm/compare_globals/main.js", + output: "npm/compare_globals/main.out", + envs: env_vars(), + http_server: true, +}); + itest!(dynamic_import { args: "run --allow-read --unstable npm/dynamic_import/main.ts", output: "npm/dynamic_import/main.out", diff --git a/cli/tests/testdata/npm/compare_globals/main.js b/cli/tests/testdata/npm/compare_globals/main.js new file mode 100644 index 000000000..ce43e32b1 --- /dev/null +++ b/cli/tests/testdata/npm/compare_globals/main.js @@ -0,0 +1,2 @@ +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 new file mode 100644 index 000000000..a1a5c0e8f --- /dev/null +++ b/cli/tests/testdata/npm/compare_globals/main.out @@ -0,0 +1,3 @@ +Download http://localhost:4545/npm/registry/@denotest/globals +Download http://localhost:4545/npm/registry/@denotest/globals/1.0.0.tgz +true diff --git a/cli/tests/testdata/npm/registry/@denotest/cjs-local-global-decls/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/cjs-local-global-decls/1.0.0/package.json index b151deaf6..1048fe76d 100644 --- a/cli/tests/testdata/npm/registry/@denotest/cjs-local-global-decls/1.0.0/package.json +++ b/cli/tests/testdata/npm/registry/@denotest/cjs-local-global-decls/1.0.0/package.json @@ -1,4 +1,4 @@ { - "name": "@deno/cjs-local-global-decls", + "name": "@denotest/cjs-local-global-decls", "version": "1.0.0" } diff --git a/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.js b/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.js new file mode 100644 index 000000000..be5e6e5ac --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.js @@ -0,0 +1,2 @@ +exports.globalThis = globalThis; +exports.global = global; diff --git a/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/package.json new file mode 100644 index 000000000..cba0742c1 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/package.json @@ -0,0 +1,4 @@ +{ + "name": "@denotest/globals", + "version": "1.0.0" +} -- cgit v1.2.3