@@ -4,27 +4,16 @@ require('../common');
4
4
const assert = require ( 'assert' ) ;
5
5
const vm = require ( 'vm' ) ;
6
6
7
- const { MakeMirror } = vm . runInDebugContext ( 'Debug' ) ;
7
+ const { MakeMirror, MakeMirrorSerializer } = vm . runInDebugContext ( 'Debug' ) ;
8
8
const proxy = new Proxy ( { x : 1 , y : 2 } , { get : Reflect . get } ) ;
9
9
const mirror = MakeMirror ( proxy , /* transient */ true ) ;
10
10
11
- assert . strictEqual ( mirror . protoObject ( ) . value ( ) , undefined ) ;
12
- assert . strictEqual ( mirror . className ( ) , 'Object' ) ;
13
- assert . strictEqual ( mirror . constructorFunction ( ) . value ( ) , undefined ) ;
14
- assert . strictEqual ( mirror . prototypeObject ( ) . value ( ) , undefined ) ;
15
- assert . strictEqual ( mirror . hasNamedInterceptor ( ) , false ) ;
16
- assert . strictEqual ( mirror . hasIndexedInterceptor ( ) , false ) ;
17
- assert . strictEqual ( mirror . referencedBy ( 1 ) . length , 0 ) ;
18
- assert . strictEqual ( mirror . toText ( ) , '#<Object>' ) ;
11
+ assert . strictEqual ( mirror . isProxy ( ) , true ) ;
12
+ assert . strictEqual ( mirror . toText ( ) , '#<Proxy>' ) ;
13
+ assert . strictEqual ( mirror . value ( ) , proxy ) ;
19
14
20
- const propertyNames = mirror . propertyNames ( ) ;
21
- const DebugContextArray = propertyNames . constructor ;
22
- assert . deepStrictEqual ( propertyNames , DebugContextArray . from ( [ 'x' , 'y' ] ) ) ;
23
-
24
- const properties = mirror . properties ( ) ;
25
- assert . strictEqual ( properties . length , 2 ) ;
26
- // UndefinedMirror because V8 cannot retrieve the values without invoking
27
- // the handler. Could be turned a PropertyMirror but mirror.value() would
28
- // still be an UndefinedMirror. This seems Good Enough for now.
29
- assert ( properties [ 0 ] . isUndefined ( ) ) ;
30
- assert ( properties [ 1 ] . isUndefined ( ) ) ;
15
+ const serializer = MakeMirrorSerializer ( /* details */ true ) ;
16
+ const serialized = serializer . serializeValue ( mirror ) ;
17
+ assert . deepStrictEqual ( Object . keys ( serialized ) . sort ( ) , [ 'text' , 'type' ] ) ;
18
+ assert . strictEqual ( serialized . type , 'proxy' ) ;
19
+ assert . strictEqual ( serialized . text , '#<Proxy>' ) ;
0 commit comments