File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ export function clone<T>(
97
97
if ( Array . isArray ( val ) ) {
98
98
out = Array ( ( k = val . length ) )
99
99
seen . set ( val , out )
100
- while ( k -- ) out [ k ] = clone ( val [ k ] , seen )
100
+ while ( k -- ) out [ k ] = clone ( val [ k ] , seen , options )
101
101
return out as any
102
102
}
103
103
@@ -110,7 +110,7 @@ export function clone<T>(
110
110
const descriptor = Object . getOwnPropertyDescriptor ( val , k )
111
111
if ( ! descriptor )
112
112
continue
113
- const cloned = clone ( ( val as any ) [ k ] , seen )
113
+ const cloned = clone ( ( val as any ) [ k ] , seen , options )
114
114
if ( 'get' in descriptor ) {
115
115
Object . defineProperty ( out , k , {
116
116
...descriptor ,
Original file line number Diff line number Diff line change @@ -303,6 +303,13 @@ describe('jest-expect', () => {
303
303
expect ( ( ) => {
304
304
expect ( complex ) . toHaveProperty ( 'a-b' , false )
305
305
} ) . toThrowErrorMatchingInlineSnapshot ( '"expected { \'0\': \'zero\', foo: 1, …(4) } to have property "a-b" with value false"' )
306
+
307
+ expect ( ( ) => {
308
+ const x = { a : { b : { c : 1 } } }
309
+ const y = { a : { b : { c : 2 } } }
310
+ Object . freeze ( x . a )
311
+ expect ( x ) . toEqual ( y )
312
+ } ) . toThrowErrorMatchingInlineSnapshot ( `"expected { a: { b: { c: 1 } } } to deeply equal { a: { b: { c: 2 } } }"` )
306
313
} )
307
314
308
315
it ( 'assertions' , ( ) => {
You can’t perform that action at this time.
0 commit comments