@@ -99,6 +99,10 @@ function init() {
99
99
visited . add ( value ) ;
100
100
}
101
101
102
+ if ( value instanceof Promise ) {
103
+ return 'Promise { <pending> }' ;
104
+ }
105
+
102
106
if ( value instanceof Set ) {
103
107
const arr = Array . from ( value , v => serializeLog ( v , visited ) ) ;
104
108
return `Set {${ arr . join ( ', ' ) } }` ;
@@ -124,6 +128,10 @@ function init() {
124
128
return `[${ arr . join ( ', ' ) } ]` ;
125
129
}
126
130
131
+ if ( value instanceof Error ) {
132
+ return `${ value . name || 'Error' } : ${ value . message } ` ;
133
+ }
134
+
127
135
if ( value instanceof Date ) {
128
136
return `Date "${ value . toISOString ( ) } "` ;
129
137
}
@@ -133,7 +141,10 @@ function init() {
133
141
}
134
142
135
143
if ( typeof value === 'object' ) {
136
- const keys = Object . keys ( value ) ;
144
+ const keys = Array . from ( new Set ( [
145
+ ...Object . getOwnPropertyNames ( value ) ,
146
+ ...Object . getOwnPropertySymbols ( value )
147
+ ] ) ) ;
137
148
if ( ! keys . length ) return '{}' ;
138
149
const props = keys . map ( k => `${ JSON . stringify ( k ) } : ${ serializeLog ( value [ k ] , visited ) } ` ) ;
139
150
return `{${ props . join ( ', ' ) } }` ;
0 commit comments