Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
test: write tests for utils/inspect
Write test to prevent this bug in future
  • Loading branch information
Adrien Bayles committed Oct 22, 2020
commit e6c2f33db2c7081a01d6296abfb6feaaf0a9baae
12 changes: 12 additions & 0 deletions test/parallel/test-util-inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,18 @@ assert.strictEqual(util.inspect(-5e-324), '-5e-324');
);
}

// Test for property descriptors on null/empty object
{
function prototype() {}
prototype.prototype = null;
const obj = {};
obj.constructor = prototype;
assert.strictEqual(
util.inspect(obj, false),
'prototype { constructor: [Function: prototype] }'
);
}

// Exceptions should print the error message, not '{}'.
{
[
Expand Down