diff options
author | Divy Srivastava <dj.srivastava23@gmail.com> | 2023-12-14 15:49:50 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-14 10:19:50 +0000 |
commit | 5ace65485f8419ad60ce5e9eb4f181bdfaa920b9 (patch) | |
tree | 0748e9ca99469fa62027449f493035d4f7ce97be /cli/tests/unit_node/vm_test.ts | |
parent | 4b6fc646467b9705550ca5750fa86923ec6c9af2 (diff) |
fix(node): return false from vm.isContext (#21568)
https://github.com/denoland/deno/issues/20851#issuecomment-1779226106
for `jsdom`
Diffstat (limited to 'cli/tests/unit_node/vm_test.ts')
-rw-r--r-- | cli/tests/unit_node/vm_test.ts | 14 |
1 files changed, 13 insertions, 1 deletions
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); + }, +}); |