File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ const {
1313 ObjectGetOwnPropertyNames,
1414 ObjectGetPrototypeOf,
1515 ObjectKeys,
16- ObjectPrototypeHasOwnProperty,
1716 ObjectPrototypeToString,
1817 RangeError,
1918 ReferenceError,
@@ -134,8 +133,7 @@ function serializeError(error) {
134133 // Continue regardless of error.
135134 }
136135 try {
137- if ( error != null &&
138- ObjectPrototypeHasOwnProperty ( error , customInspectSymbol ) ) {
136+ if ( error != null && customInspectSymbol in error ) {
139137 return Buffer . from ( StringFromCharCode ( kCustomInspectedObject ) + inspect ( error ) , 'utf8' ) ;
140138 }
141139 } catch {
Original file line number Diff line number Diff line change @@ -125,3 +125,11 @@ const data = {
125125 }
126126} ;
127127assert . strictEqual ( inspect ( cycle ( data ) ) , 'barbaz' ) ;
128+
129+ const inheritedCustomInspect = new class {
130+ foo = 'bar' ;
131+ [ inspect . custom ] ( ) {
132+ return 'barbaz' ;
133+ }
134+ } ( ) ;
135+ assert . strictEqual ( inspect ( cycle ( inheritedCustomInspect ) ) , 'barbaz' ) ;
You can’t perform that action at this time.
0 commit comments