The code attaches global properties to the sandbox context by iterating
over all the enumerable properties of global. However, in node v10,
console switched to being non-enmuerable. This means that for
users of this library with node>10, any console.logs in evaluated
scripts will fail.
This commit fixes this issue by manually attaching console to the
sandbox (when globals are being used). A test has been added. Prior to
the change to eval.js, the test would pass in node v8 but fail in v10
and v12.
Also, the tests were already failing in v12, because in v12 process
also became non-enumerable. I've applied a similar fix to process to
ensure that it's always available too.
The code attaches global properties to the sandbox context by iterating over all the enumerable properties of
global
. However, in node v10,console
switched to being non-enmuerable. This means that for users of this library with node>10, anyconsole.log
s in evaluated scripts will fail.This commit fixes this issue by manually attaching console to the sandbox (when globals are being used). A test has been added. Prior to the change to eval.js, the test would pass in node v8 but fail in v10 and v12.
Also, the tests were already failing in v12, because in v12
process
also became non-enumerable. I've applied a similar fix toprocess
to ensure that it's always available too.