@@ -3612,20 +3612,38 @@ describe('ReactFresh', () => {
3612
3612
const useStore = ( ) => { } ;
3613
3613
expect ( ReactFreshRuntime . isLikelyComponentType ( useStore ) ) . toBe ( false ) ;
3614
3614
expect ( ReactFreshRuntime . isLikelyComponentType ( useTheme ) ) . toBe ( false ) ;
3615
+ const rogueProxy = new Proxy ( { } , {
3616
+ get ( target , property ) {
3617
+ throw new Error ( ) ;
3618
+ }
3619
+ } ) ;
3620
+ expect ( ReactFreshRuntime . isLikelyComponentType ( rogueProxy ) ) . toBe ( false ) ;
3615
3621
3616
3622
// These seem like function components.
3617
3623
const Button = ( ) => { } ;
3618
3624
expect ( ReactFreshRuntime . isLikelyComponentType ( Button ) ) . toBe ( true ) ;
3619
3625
expect ( ReactFreshRuntime . isLikelyComponentType ( Widget ) ) . toBe ( true ) ;
3626
+ const ProxyButton = new Proxy ( Button , {
3627
+ get ( target , property ) {
3628
+ return target [ property ] ;
3629
+ }
3630
+ } ) ;
3631
+ expect ( ReactFreshRuntime . isLikelyComponentType ( ProxyButton ) ) . toBe ( true ) ;
3620
3632
const anon = ( ( ) => ( ) => { } ) ( ) ;
3621
3633
anon . displayName = 'Foo' ;
3622
3634
expect ( ReactFreshRuntime . isLikelyComponentType ( anon ) ) . toBe ( true ) ;
3623
3635
3624
3636
// These seem like class components.
3625
3637
class Btn extends React . Component { }
3626
3638
class PureBtn extends React . PureComponent { }
3639
+ const ProxyBtn = new Proxy ( Btn , {
3640
+ get ( target , property ) {
3641
+ return target [ property ] ;
3642
+ }
3643
+ } ) ;
3627
3644
expect ( ReactFreshRuntime . isLikelyComponentType ( Btn ) ) . toBe ( true ) ;
3628
3645
expect ( ReactFreshRuntime . isLikelyComponentType ( PureBtn ) ) . toBe ( true ) ;
3646
+ expect ( ReactFreshRuntime . isLikelyComponentType ( ProxyBtn ) ) . toBe ( true ) ;
3629
3647
expect (
3630
3648
ReactFreshRuntime . isLikelyComponentType (
3631
3649
createReactClass ( { render ( ) { } } ) ,
0 commit comments