From 5ace65485f8419ad60ce5e9eb4f181bdfaa920b9 Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Thu, 14 Dec 2023 15:49:50 +0530 Subject: fix(node): return false from vm.isContext (#21568) https://github.com/denoland/deno/issues/20851#issuecomment-1779226106 for `jsdom` --- cli/tests/unit_node/vm_test.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'cli') diff --git a/cli/tests/unit_node/vm_test.ts b/cli/tests/unit_node/vm_test.ts index c43495e1d..6f190ab08 100644 --- a/cli/tests/unit_node/vm_test.ts +++ b/cli/tests/unit_node/vm_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2023 the Deno authors. All rights reserved. MIT license. -import { runInNewContext } from "node:vm"; +import { isContext, runInNewContext } from "node:vm"; import { assertEquals, assertThrows, @@ -55,3 +55,15 @@ Deno.test({ } }, }); + +Deno.test({ + name: "vm isContext", + fn() { + // Currently we do not expose VM contexts so this is always false. + const obj = {}; + assertEquals(isContext(obj), false); + assertEquals(isContext(globalThis), false); + const sandbox = runInNewContext("{}"); + assertEquals(isContext(sandbox), false); + }, +}); -- cgit v1.2.3