From 672e8e6e25c3aa3021c8d2523c086015e336d1e1 Mon Sep 17 00:00:00 2001 From: alxndrsn Date: Tue, 21 Oct 2025 17:30:14 +0000 Subject: [PATCH 1/3] fix: handle empty null-prototyped objects Closes #5505 --- lib/utils.js | 1 + test/unit/utils.spec.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/lib/utils.js b/lib/utils.js index 4971b8de46..f223c62a46 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -108,6 +108,7 @@ function emptyRepresentation(value, typeHint) { switch (typeHint) { case 'function': return '[Function]'; + case 'null-prototype': case 'object': return '{}'; case 'array': diff --git a/test/unit/utils.spec.js b/test/unit/utils.spec.js index 0e54bf394e..18b17bc41c 100644 --- a/test/unit/utils.spec.js +++ b/test/unit/utils.spec.js @@ -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'}, From 854a16701e6cd0c4f48873e14e674a80d7167ed1 Mon Sep 17 00:00:00 2001 From: alxndrsn Date: Tue, 4 Nov 2025 13:56:27 +0000 Subject: [PATCH 2/3] rebuild for CLA? --- rebuild | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 rebuild diff --git a/rebuild b/rebuild new file mode 100644 index 0000000000..e69de29bb2 From 0558c5be41a0b648ea916a6ebfc6172afd67edc1 Mon Sep 17 00:00:00 2001 From: alxndrsn Date: Tue, 4 Nov 2025 13:56:34 +0000 Subject: [PATCH 3/3] rebuild again to remove rebuild file --- rebuild | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 rebuild diff --git a/rebuild b/rebuild deleted file mode 100644 index e69de29bb2..0000000000