michaelwittig/node-q

Problem when using 'strict mode'

Closed this issue · 3 comments

I'm getting TypeError when running node with strict mode. This seems to be an issue in assert-plus. Strict mode doesn't allow assert-plus to access caller's properties. I can get around this by adding environment variable NODE_NDEBUG (this will disable assert).

Looks like you are using assert-plus for checking args. Maybe this is not really required? or maybe this issue should be raised with assert-plus instead?

p.s. using strict mode is not a must, but it would be nice so I can use some cool ES6 features :)

Here is how to reproduce:
node --use_strict qfunc_test.js

var nodeq = require("node-q");

nodeq.connect({host: 'localhost', port: 5555}, function(err, con) {
    console.log('connected');
});
/Users/komsit/.nvm/versions/node/v0.12.7/bin/node --use_strict qfunc_test.js
/workspace/mysnippets/node_modules/node-q/node_modules/assert-plus/assert.js:41
                stackFunc = stackFunc || _assert.caller;
                                                ^
TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions or the arguments objects for calls to them
    at _assert (/workspace/mysnippets/node_modules/node-q/node_modules/assert-plus/assert.js:41:49)
    at Object.object (/workspace/mysnippets/node_modules/node-q/node_modules/assert-plus/assert.js:141:9)
    at Object.connect (/workspace/mysnippets/node_modules/node-q/index.js:185:9)
    at Object.<anonymous> (/workspace/mysnippets/q/qfunc_test.js:3:7)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)

Hi,
as you said the problem is inside a dependency. The dependency is only used the check inputs so this can be easily changed. I will research a better solution.
Thanks for reporting!

version 1.2.0 includes the fix

Cool, thanks!