mirror of
https://github.com/denoland/deno.git
synced 2024-12-25 00:29:09 -05:00
fix(node): return false from vm.isContext (#21568)
https://github.com/denoland/deno/issues/20851#issuecomment-1779226106 for `jsdom`
This commit is contained in:
parent
4b6fc64646
commit
5ace65485f
2 changed files with 15 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
||||||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||||
import { runInNewContext } from "node:vm";
|
import { isContext, runInNewContext } from "node:vm";
|
||||||
import {
|
import {
|
||||||
assertEquals,
|
assertEquals,
|
||||||
assertThrows,
|
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);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
|
@ -75,7 +75,8 @@ export function runInThisContext(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isContext(_maybeContext: any) {
|
export function isContext(_maybeContext: any) {
|
||||||
notImplemented("isContext");
|
// TODO(@littledivy): Currently we do not expose contexts so this is always false.
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function compileFunction(_code: string, _params: any, _options: any) {
|
export function compileFunction(_code: string, _params: any, _options: any) {
|
||||||
|
|
Loading…
Reference in a new issue