From d0a7ec981c38f55edfd427def1ef9a848d72cc5e Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Tue, 18 Jun 2024 16:33:03 +0530 Subject: [PATCH] fix(ext/node): make process.versions own property (#24240) --- ext/node/polyfills/process.ts | 3 +++ tests/unit_node/process_test.ts | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/ext/node/polyfills/process.ts b/ext/node/polyfills/process.ts index a001d2e0fe..bec62122b5 100644 --- a/ext/node/polyfills/process.ts +++ b/ext/node/polyfills/process.ts @@ -731,6 +731,9 @@ if (isWindows) { // @ts-ignore TS doesn't work well with ES5 classes const process = new Process(); +/* Set owned property */ +process.versions = versions; + Object.defineProperty(process, Symbol.toStringTag, { enumerable: false, writable: true, diff --git a/tests/unit_node/process_test.ts b/tests/unit_node/process_test.ts index 24fd3909da..e15d37744c 100644 --- a/tests/unit_node/process_test.ts +++ b/tests/unit_node/process_test.ts @@ -1116,3 +1116,7 @@ Deno.test("process.listeners - include SIG* events", () => { process.off("SIGINT", listener2); assertEquals(process.listeners("SIGINT").length, 0); }); + +Deno.test(function processVersionsOwnProperty() { + assert(Object.prototype.hasOwnProperty.call(process, "versions")); +});