@@ -6,29 +6,29 @@ const vm = require('vm');
66const Script = vm . Script ;
77let script = new Script ( '"passed";' ) ;
88
9- console . error ( 'run in a new empty context' ) ;
9+ // Run in a new empty context
1010let context = vm . createContext ( ) ;
1111let result = script . runInContext ( context ) ;
1212assert . strictEqual ( 'passed' , result ) ;
1313
14- console . error ( 'create a new pre-populated context' ) ;
15- context = vm . createContext ( { 'foo' : 'bar' , 'thing' : 'lala' } ) ;
14+ // Create a new pre-populated context
15+ context = vm . createContext ( { 'foo' : 'bar' , 'thing' : 'lala' } ) ;
1616assert . strictEqual ( 'bar' , context . foo ) ;
1717assert . strictEqual ( 'lala' , context . thing ) ;
1818
19- console . error ( 'test updating context' ) ;
19+ // Test updating context
2020script = new Script ( 'foo = 3;' ) ;
2121result = script . runInContext ( context ) ;
2222assert . strictEqual ( 3 , context . foo ) ;
2323assert . strictEqual ( 'lala' , context . thing ) ;
2424
2525// Issue GH-227:
26- assert . throws ( function ( ) {
26+ assert . throws ( ( ) => {
2727 vm . runInNewContext ( '' , null , 'some.js' ) ;
2828} , / ^ 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 $ / ) ;
2929
3030// Issue GH-1140:
31- console . error ( 'test runInContext signature' ) ;
31+ // Test runInContext signature
3232let gh1140Exception ;
3333try {
3434 vm . runInContext ( 'throw new Error()' , context , 'expected-filename.js' ) ;
@@ -56,8 +56,8 @@ const contextifiedSandboxErrorMsg =
5656} ) ;
5757
5858// Issue GH-693:
59- console . error ( 'test RegExp as argument to assert.throws' ) ;
60- script = vm . createScript ( 'var assert = require(\'assert\'); assert.throws(' +
59+ // Test RegExp as argument to assert.throws
60+ script = vm . createScript ( 'const assert = require(\'assert\'); assert.throws(' +
6161 'function() { throw "hello world"; }, /hello/);' ,
6262 'some.js' ) ;
6363script . runInNewContext ( { require : require } ) ;
@@ -71,14 +71,14 @@ assert.strictEqual(script.runInContext(ctx), false);
7171
7272// Error on the first line of a module should
7373// have the correct line and column number
74- assert . throws ( function ( ) {
74+ assert . throws ( ( ) => {
7575 vm . runInContext ( 'throw new Error()' , context , {
7676 filename : 'expected-filename.js' ,
7777 lineOffset : 32 ,
7878 columnOffset : 123
7979 } ) ;
80- } , function ( err ) {
81- 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 ) ;
80+ } , ( err ) => {
81+ 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 ) ;
8282} , 'Expected appearance of proper offset in Error stack' ) ;
8383
8484// https://github.com/nodejs/node/issues/6158
0 commit comments