Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function test() {
iters++;
const bp = {id: 'fake-breakpoint', location: {path: __filename, line: 4}};
v8debugapi.set(bp);
v8debugapi.clear(bp);
if (iters % 100 === 0) {
console.log(iters + ' ' + util.inspect(process.memoryUsage()));
}
// infinite loop
setImmediate(test);
}
assert(/TypeError: FAIL/.test(util.inspect(new TypeError('FAIL'))));
assert(/SyntaxError: FAIL/.test(util.inspect(new SyntaxError('FAIL'))));
try {
undef();
} catch (e) {
assert(/ReferenceError.*undef/.test(util.inspect(e)));
}
var ex = util.inspect(new Error('FAIL'), true);
assert.ok(ex.indexOf('[Error: FAIL]') != -1);
// Rhino doesn't put stack on Error constructor yet
//assert.ok(ex.indexOf('[stack]') != -1);
//assert.ok(ex.indexOf('[message]') != -1);
// GH-1941
// should not throw:
assert.equal(util.inspect(Object.create(Date.prototype)), '{}');
// GH-1944
assert.doesNotThrow(function() {
var d = new Date();
d.toUTCString = null;
util.inspect(d);
});
assert.doesNotThrow(function() {
var r = /regexp/;
r.toString = null;
util.inspect(r);
});
// bug with user-supplied inspect function returns non-string
assert.doesNotThrow(function() {
return {
file: file,
text: fs.readFileSync(file, 'utf8')
}
})
if (program.lib) {
inputs.unshift({
file: ">lib.d.ts",
text: fs.readFileSync(__dirname + '/lib/lib.d.ts', 'utf8')
})
}
var json = convert(inputs)
if (program.silent)
{}
else if (program.pretty)
console.log(util.inspect(json, {depth:null}))
else
console.log(JSON.stringify(json))
}
if (output instanceof Promise) {
repl.context._p = output;
let promiseId = nextPromiseId++;
output.then((result) => {
console.log(`\n`);
console.log(util.inspect(result));
repl.context._r = result;
repl.displayPrompt(true)
}, (error) => {
console.log(`\n`);
console.log(util.inspect(error));
repl.displayPrompt(true)
});
return ``;
}
return util.inspect(output);
}
return JSON.stringify(args[i++]);
}
} catch(e) {
return '[Circular]';
}
case '%t':
return util.inspect(args[i++], inspectOpt);
default:
return x;
}
});
for ( var len = args.length, x = args[i]; i < len; x = args[++i]) {
if (x === null || typeof x !== 'object') {
str += ' ' + x;
} else {
str += ' ' + util.inspect(x, inspectOpt);
}
}
return str;
};
PlainLogReporter.prototype.normizalizeForOutput = function (message) {
return "string" == typeof message ? message : util.inspect(message, {depth: 4, color: false, showHidden: true});
}
.then(async (previousEnvelope: AskModel.ResponseEnvelope): Promise => {
if (condition.isEnabledTrace) {
Logger.trace(`\npreviousEnvelope:\n${Util.inspect(previousEnvelope, { depth: null })}`);
}
const request = requestBuilder.build(intentName, conditionRequest, previousEnvelope);
if (condition.isEnabledTrace) {
Logger.trace(`\nrequest:\n${Util.inspect(request, { depth: null })}`);
}
const envelope = await RunHandler.runAsync(condition.handler, request);
if (condition.isEnabledTrace) {
Logger.trace(`\nenvelope: \n${Util.inspect(envelope, { depth: null })}`);
}
Object.assign(scenarios[currentIndex], { intentName, envelope });
return envelope;
async function onPartCommand(conn, params, prefix) {
let channel = params[0];
try {
await conn.rocketchat.leaveRoom(channel);
} catch (e) {
log.error(e.stack || util.inspect(e, {
colors: true,
depth: null
}));
}
}