From afe05cdf2e159407a216579b6b3c0735ea7c4d6b Mon Sep 17 00:00:00 2001 From: Joshua Peek Date: Tue, 3 Feb 2015 13:37:58 -0800 Subject: [PATCH] Normalize `global` --- lib/execjs/support/node_runner.js | 2 +- test/test_execjs.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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'")