JSON.parse stack traces break when using register
jkrems opened this issue · comments
Jan Olaf Martin commented
Minimal reproduction (using node 4):
rm -rf /tmp/missing-stack-trace; mkdir $_; cd $_
npm install coffee-script-redux coffee-script
echo 'JSON.parse("")' >b.coffee; echo 'require("./b.coffee")' >a.js
With redux:
> node -r coffee-script-redux/register a
undefined:1
SyntaxError: Unexpected end of input
With coffee-script:
> node -r coffee-script/register a
undefined:1
SyntaxError: Unexpected end of input
at Object.parse (native)
at Object.<anonymous> (/private/tmp/missing-stack-trace/b.coffee:1:6)
at Object.<anonymous> (/private/tmp/missing-stack-trace/b.coffee:1:1)
at Module._compile (module.js:434:26)
at Object.loadFile (/private/tmp/missing-stack-trace/node_modules/coffee-script/lib/coffee-script/register.js:16:19)
at Module.load (/private/tmp/missing-stack-trace/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/private/tmp/missing-stack-trace/a.js:1:63)
at Module._compile (module.js:434:26)
at Object.Module._extensions..js (module.js:452:10)
at Module.load (/private/tmp/missing-stack-trace/node_modules/coffee-script/lib/coffee-script/register.js:45:36)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:475:10)
at startup (node.js:118:18)
at node.js:952:3
The stack traces for JSON.parse
disappear everywhere (and won't come, even in the following event loop ticks) the moment the first coffee-script file is required using -redux.
Michael Ficarra commented
Is this just in recent versions of node? Have you tested whether 0.12 is affected? Do other stack traces work properly? Have you caught the error and inspected the stack
yourself instead of allowing node to print it?