File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
jest-environment-node/src Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -277,8 +277,8 @@ class GlobalProxy implements ProxyHandler<typeof globalThis> {
277
277
...this . leftovers ,
278
278
] ) {
279
279
/*
280
- * react-native invoke its custom `performance` property after env teardown.
281
- * its setup file should use `protectProperties` to prevent this.
280
+ * React Native's test setup invokes their custom `performance` property after env teardown.
281
+ * Once they start using `protectProperties`, we can get rid of this.
282
282
*/
283
283
if ( property !== 'performance' ) {
284
284
deleteProperties ( value ) ;
Original file line number Diff line number Diff line change @@ -50,5 +50,10 @@ export function protectProperties<T extends object>(
50
50
* @param value The given value.
51
51
*/
52
52
export function canDeleteProperties ( value : unknown ) : value is object {
53
- return value !== null && [ 'object' , 'function' ] . includes ( typeof value ) ;
53
+ if ( value !== null ) {
54
+ const type = typeof value ;
55
+ return type === 'object' || type === 'function' ;
56
+ }
57
+
58
+ return false ;
54
59
}
You can’t perform that action at this time.
0 commit comments