Closed
Description
I'm not entirely sure if this is a bug or my misunderstanding, but I was surprised to discover that these two expressions have different values in the 5.1.0 node repl:
vm.runInNewContext("util.inspect({})", { util: util }) //=> 'Object {}'
util.inspect({}) //=> '{}'
or for standalone examples outside of the repl:
bash> node -pe "require('vm').runInNewContext('util.inspect({})', { util: require('util') })"
Object {}
bash> node -pe "require('util').inspect({})"
{}
Is this intended behavior? Is there a way to get the repl equivalent result from util.inspect
in a vm
without resorting to string replacement?