diff --git a/lib/execjs/support/node_runner.js b/lib/execjs/support/node_runner.js index c27e6c0..46210f9 100644 --- a/lib/execjs/support/node_runner.js +++ b/lib/execjs/support/node_runner.js @@ -1,4 +1,4 @@ -(function(program, execJS) { execJS(program) })(function(module, exports, require, console, setTimeout, setInterval, clearTimeout, clearInterval, setImmediate, clearImmediate) { #{source} +(function(program, execJS) { execJS(program) })(function(global, module, exports, require, console, setTimeout, setInterval, clearTimeout, clearInterval, setImmediate, clearImmediate) { #{source} }, function(program) { var output, print = function(string) { process.stdout.write('' + string); diff --git a/test/test_execjs.rb b/test/test_execjs.rb index d093d8f..7144e18 100644 --- a/test/test_execjs.rb +++ b/test/test_execjs.rb @@ -221,6 +221,7 @@ class TestExecJS < Test end def test_commonjs_vars_are_undefined + assert ExecJS.eval("typeof global == 'undefined'") assert ExecJS.eval("typeof module == 'undefined'") assert ExecJS.eval("typeof exports == 'undefined'") assert ExecJS.eval("typeof require == 'undefined'")