Flesh out util_stub a little more

This commit is contained in:
Tony Garnock-Jones 2020-08-05 13:05:35 +02:00
parent 2fcd2806ab
commit 212a92605e
2 changed files with 10 additions and 2 deletions

View File

@ -378,7 +378,7 @@ Index.prototype.sendMessage = function(v, leafCallback) {
Node.prototype._debugString = function (outerIndent) {
const pieces = [];
const inspect = require('util').inspect || JSON.stringify;
const inspect = require('util').inspect;
function line(indent, content) {
pieces.push(indent);
pieces.push(content);

View File

@ -1,3 +1,11 @@
module.exports = {
inspect: void 0,
inspect: (item) => {
try {
return JSON.stringify(item);
} catch (_e) {
return '<uninspectable_value>';
}
},
};
module.exports.inspect.custom = Symbol('util_stub.inspect.custom');