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