@@ -4,27 +4,16 @@ require('../common');
44const assert = require ( 'assert' ) ;
55const vm = require ( 'vm' ) ;
66
7- const { MakeMirror } = vm . runInDebugContext ( 'Debug' ) ;
7+ const { MakeMirror, MakeMirrorSerializer } = vm . runInDebugContext ( 'Debug' ) ;
88const proxy = new Proxy ( { x : 1 , y : 2 } , { get : Reflect . get } ) ;
99const mirror = MakeMirror ( proxy , /* transient */ true ) ;
1010
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 ) ;
1914
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