Node: v16.13.1 under OS: macos 12.2 (Darwin Kernel Version 21.3.0)
Under the following circumstance, the evaluate method when used with replMode
and throwOnSideEffect
parameters does not do anything. The same method works perfectly when throwOnSideEffect
and replMode
are set separately, or when a different expression is provided (such as 1+1
). Evaluating a non existing variable seems not being appealing to NodeJS. I am expecting an ReferenceError
result but instead the process just returns 0.
I am using the function wrong or I missed something... ?
const inspector = require('inspector');
const session = new inspector.Session();
session.connect();
function myEval(expression, throwOnSideEffect, timeout, replMode) {
session.post(
'Runtime.evaluate',
{ expression, throwOnSideEffect, timeout, replMode },
(err, res) => {
if (err) {
return console.error('err');
}
return console.log('works', res);
});
}
// does not work as expected when executed alone
myEval('doesNotExist', true, 200, true);
// works as expected
// myEval(exp, true, 200, false);
// works as expected
// myEval(exp, false, 200, true);
Upgrading node to the version v17.7.2
resolved the problem.