@@ -27,29 +27,29 @@ const vm = require('vm');
27
27
const Script = vm . Script ;
28
28
let script = new Script ( '"passed";' ) ;
29
29
30
- console . error ( 'run in a new empty context' ) ;
30
+ // Run in a new empty context
31
31
let context = vm . createContext ( ) ;
32
32
let result = script . runInContext ( context ) ;
33
33
assert . strictEqual ( 'passed' , result ) ;
34
34
35
- console . error ( 'create a new pre-populated context' ) ;
35
+ // Create a new pre-populated context
36
36
context = vm . createContext ( { 'foo' : 'bar' , 'thing' : 'lala' } ) ;
37
37
assert . strictEqual ( 'bar' , context . foo ) ;
38
38
assert . strictEqual ( 'lala' , context . thing ) ;
39
39
40
- console . error ( 'test updating context' ) ;
40
+ // Test updating context
41
41
script = new Script ( 'foo = 3;' ) ;
42
42
result = script . runInContext ( context ) ;
43
43
assert . strictEqual ( 3 , context . foo ) ;
44
44
assert . strictEqual ( 'lala' , context . thing ) ;
45
45
46
46
// Issue GH-227:
47
- assert . throws ( function ( ) {
47
+ assert . throws ( ( ) => {
48
48
vm . runInNewContext ( '' , null , 'some.js' ) ;
49
49
} , / ^ T y p e E r r o r : s a n d b o x m u s t b e a n o b j e c t $ / ) ;
50
50
51
51
// Issue GH-1140:
52
- console . error ( 'test runInContext signature' ) ;
52
+ // Test runInContext signature
53
53
let gh1140Exception ;
54
54
try {
55
55
vm . runInContext ( 'throw new Error()' , context , 'expected-filename.js' ) ;
@@ -77,7 +77,7 @@ const contextifiedSandboxErrorMsg =
77
77
} ) ;
78
78
79
79
// Issue GH-693:
80
- console . error ( 'test RegExp as argument to assert.throws' ) ;
80
+ // Test RegExp as argument to assert.throws
81
81
script = vm . createScript ( 'const assert = require(\'assert\'); assert.throws(' +
82
82
'function() { throw "hello world"; }, /hello/);' ,
83
83
'some.js' ) ;
@@ -92,13 +92,13 @@ assert.strictEqual(script.runInContext(ctx), false);
92
92
93
93
// Error on the first line of a module should
94
94
// have the correct line and column number
95
- assert . throws ( function ( ) {
95
+ assert . throws ( ( ) => {
96
96
vm . runInContext ( 'throw new Error()' , context , {
97
97
filename : 'expected-filename.js' ,
98
98
lineOffset : 32 ,
99
99
columnOffset : 123
100
100
} ) ;
101
- } , function ( err ) {
101
+ } , ( err ) => {
102
102
return / e x p e c t e d - f i l e n a m e \. j s : 3 3 : 1 3 0 / . test ( err . stack ) ;
103
103
} , 'Expected appearance of proper offset in Error stack' ) ;
104
104
0 commit comments