summaryrefslogtreecommitdiff
path: root/tests/unit_node/process_test.ts
diff options
context:
space:
mode:
authorMarvin Hagemeister <marvin@deno.com>2024-05-17 16:24:07 +0200
committerGitHub <noreply@github.com>2024-05-17 16:24:07 +0200
commit75efc74931c1021fdc41c96f45a4e20ae4609e50 (patch)
tree52b6d8c3a76a5463b25d94b52d8228b52cebaa00 /tests/unit_node/process_test.ts
parent812f2e4c22182fdbaf783dba3cc9d178783eced7 (diff)
fix(node): instantiating process class without new (#23865)
Popular test runners like Jest instantiate a new `Process` object themselves and expect the class constructor to be callable without the `new` keyword. This PR refactors our `Process` class implementation from a proper ES2015 class to an ES5-style class which can be invoked both with and without the `new` keyword like in Node. Fixes https://github.com/denoland/deno/issues/23863
Diffstat (limited to 'tests/unit_node/process_test.ts')
-rw-r--r--tests/unit_node/process_test.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/unit_node/process_test.ts b/tests/unit_node/process_test.ts
index 6b90a30ba..491a70bfc 100644
--- a/tests/unit_node/process_test.ts
+++ b/tests/unit_node/process_test.ts
@@ -1094,3 +1094,12 @@ Deno.test({
assert(v >= 0);
},
});
+
+// Test for https://github.com/denoland/deno/issues/23863
+Deno.test({
+ name: "instantiate process constructor without 'new' keyword",
+ fn() {
+ // This would throw
+ process.constructor.call({});
+ },
+});