File tree 2 files changed +15
-2
lines changed
2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
2
- import { runInNewContext } from "node:vm" ;
2
+ import { isContext , runInNewContext } from "node:vm" ;
3
3
import {
4
4
assertEquals ,
5
5
assertThrows ,
@@ -55,3 +55,15 @@ Deno.test({
55
55
}
56
56
} ,
57
57
} ) ;
58
+
59
+ Deno . test ( {
60
+ name : "vm isContext" ,
61
+ fn ( ) {
62
+ // Currently we do not expose VM contexts so this is always false.
63
+ const obj = { } ;
64
+ assertEquals ( isContext ( obj ) , false ) ;
65
+ assertEquals ( isContext ( globalThis ) , false ) ;
66
+ const sandbox = runInNewContext ( "{}" ) ;
67
+ assertEquals ( isContext ( sandbox ) , false ) ;
68
+ } ,
69
+ } ) ;
Original file line number Diff line number Diff line change @@ -75,7 +75,8 @@ export function runInThisContext(
75
75
}
76
76
77
77
export function isContext ( _maybeContext : any ) {
78
- notImplemented ( "isContext" ) ;
78
+ // TODO(@littledivy): Currently we do not expose contexts so this is always false.
79
+ return false ;
79
80
}
80
81
81
82
export function compileFunction ( _code : string , _params : any , _options : any ) {
You can’t perform that action at this time.
0 commit comments