diff options
author | Luca Casonato <hello@lcas.dev> | 2024-09-04 11:04:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-04 11:04:06 +0200 |
commit | b333dccee82f4328a65d0c3c45c7aa5c19255220 (patch) | |
tree | 6799aff43eb6c8f2e1186c18a2b973b056f967a4 /tests | |
parent | 4c3b17b54703b455d8ae4b51354d18838c090658 (diff) |
feat(cli): give access to `process` global everywhere (#25291)
Diffstat (limited to 'tests')
7 files changed, 1 insertions, 28 deletions
diff --git a/tests/node_compat/polyfill_globals.js b/tests/node_compat/polyfill_globals.js index 93246d2ef..79e1cc3f9 100644 --- a/tests/node_compat/polyfill_globals.js +++ b/tests/node_compat/polyfill_globals.js @@ -1,5 +1,4 @@ // Copyright 2018-2024 the Deno authors. All rights reserved. MIT license. -import process from "node:process"; import { Buffer } from "node:buffer"; import { clearImmediate, @@ -10,15 +9,12 @@ import { setTimeout, } from "node:timers"; import { performance } from "node:perf_hooks"; -import console from "node:console"; globalThis.Buffer = Buffer; globalThis.clearImmediate = clearImmediate; globalThis.clearInterval = clearInterval; globalThis.clearTimeout = clearTimeout; -globalThis.console = console; globalThis.global = globalThis; globalThis.performance = performance; -globalThis.process = process; globalThis.setImmediate = setImmediate; globalThis.setInterval = setInterval; globalThis.setTimeout = setTimeout; diff --git a/tests/registry/npm/@denotest/globals/1.0.0/index.d.ts b/tests/registry/npm/@denotest/globals/1.0.0/index.d.ts index 76dd781db..548633db1 100644 --- a/tests/registry/npm/@denotest/globals/1.0.0/index.d.ts +++ b/tests/registry/npm/@denotest/globals/1.0.0/index.d.ts @@ -15,7 +15,6 @@ type _TestHasProcessGlobal = AssertTrue< export function deleteSetTimeout(): void; export function getSetTimeout(): typeof setTimeout; -export function checkProcessGlobal(): void; export function checkWindowGlobal(): void; export function checkSelfGlobal(): void; diff --git a/tests/registry/npm/@denotest/globals/1.0.0/index.js b/tests/registry/npm/@denotest/globals/1.0.0/index.js index 64f913b37..542cb63d2 100644 --- a/tests/registry/npm/@denotest/globals/1.0.0/index.js +++ b/tests/registry/npm/@denotest/globals/1.0.0/index.js @@ -10,11 +10,6 @@ exports.getSetTimeout = function () { return globalThis.setTimeout; }; -exports.checkProcessGlobal = function () { - console.log("process" in globalThis); - console.log(Object.getOwnPropertyDescriptor(globalThis, "process") !== undefined); -}; - exports.checkWindowGlobal = function () { console.log("window" in globalThis); console.log(Object.getOwnPropertyDescriptor(globalThis, "window") !== undefined); diff --git a/tests/specs/lint/node_globals_no_duplicate_imports/__test__.jsonc b/tests/specs/lint/node_globals_no_duplicate_imports/__test__.jsonc index d8e00f47a..a632e896e 100644 --- a/tests/specs/lint/node_globals_no_duplicate_imports/__test__.jsonc +++ b/tests/specs/lint/node_globals_no_duplicate_imports/__test__.jsonc @@ -3,8 +3,7 @@ "steps": [ { "args": "run main.ts", - "output": "error.out", - "exitCode": 1 + "output": "" }, { "args": "lint main.ts", diff --git a/tests/specs/lint/node_globals_no_duplicate_imports/error.out b/tests/specs/lint/node_globals_no_duplicate_imports/error.out deleted file mode 100644 index 5671b17b4..000000000 --- a/tests/specs/lint/node_globals_no_duplicate_imports/error.out +++ /dev/null @@ -1,4 +0,0 @@ -error: Uncaught (in promise) ReferenceError: process is not defined -const _foo = process.env.FOO; - ^ - at [WILDCARD]main.ts:3:14 diff --git a/tests/testdata/npm/compare_globals/main.out b/tests/testdata/npm/compare_globals/main.out index 5b1d26464..f6f90d533 100644 --- a/tests/testdata/npm/compare_globals/main.out +++ b/tests/testdata/npm/compare_globals/main.out @@ -15,10 +15,6 @@ setTimeout 2 function setTimeout 3 function setTimeout 4 function setTimeout 5 undefined -process 1 false -process 2 false -true -true window 1 false window 2 false false diff --git a/tests/testdata/npm/compare_globals/main.ts b/tests/testdata/npm/compare_globals/main.ts index 5019a5fd5..9482798d8 100644 --- a/tests/testdata/npm/compare_globals/main.ts +++ b/tests/testdata/npm/compare_globals/main.ts @@ -30,14 +30,6 @@ globals.deleteSetTimeout(); console.log("setTimeout 4", typeof globalThis.setTimeout); console.log("setTimeout 5", typeof globals.getSetTimeout()); -// In Deno, the process global is not defined, but in Node it is. -console.log("process 1", "process" in globalThis); -console.log( - "process 2", - Object.getOwnPropertyDescriptor(globalThis, "process") !== undefined, -); -globals.checkProcessGlobal(); - // In Deno 2 and Node.js, the window global is not defined. console.log("window 1", "window" in globalThis); console.log( |