Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ function emptyRepresentation(value, typeHint) {
switch (typeHint) {
case 'function':
return '[Function]';
case 'null-prototype':
case 'object':
return '{}';
case 'array':
Expand Down
7 changes: 7 additions & 0 deletions test/unit/utils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,13 @@ describe('lib/utils', function () {
});

describe('should represent null prototypes', function () {
it('Without properties', function () {
const foo = Object.create(null, {});
const expected = '{}';

expect(stringify(foo), 'to be', expected);
});

it('With explicit names', function () {
const foo = Object.create(null, {
[Symbol.toStringTag]: {value: 'Foo'},
Expand Down
Loading