util: mark special properties when inspecting them · nodejs/node@c220da0 · GitHub
Skip to content

Commit c220da0

Browse files
BridgeARaduh95
authored andcommitted
util: mark special properties when inspecting them
This makes sure special properties (such as a byteLength, buffer, and more) are marked that they are not regular properties. They are mostly getters, that just seemed even more of a breaking change. Thus, they just use square brackets for now. On top of that, it makes inspecting detached DataViews robust. Inspecting those failed so far. PR-URL: #60131 Reviewed-By: Jordan Harband <ljharb@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 931b80f commit c220da0

3 files changed

Lines changed: 103 additions & 79 deletions

File tree

lib/internal/util/inspect.js

Lines changed: 41 additions & 28 deletions

test/parallel/test-util-format.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ assert.strictEqual(
588588

589589
assert.strictEqual(
590590
util.format(new SharedArrayBuffer(4)),
591-
'SharedArrayBuffer { [Uint8Contents]: <00 00 00 00>, byteLength: 4 }'
591+
'SharedArrayBuffer { [Uint8Contents]: <00 00 00 00>, [byteLength]: 4 }'
592592
);
593593

594594
assert.strictEqual(

test/parallel/test-util-inspect.js

Lines changed: 61 additions & 50 deletions

0 commit comments

Comments
 (0)