@@ -3612,20 +3612,38 @@ describe('ReactFresh', () => {
36123612 const useStore = ( ) => { } ;
36133613 expect ( ReactFreshRuntime . isLikelyComponentType ( useStore ) ) . toBe ( false ) ;
36143614 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 ) ;
36153621
36163622 // These seem like function components.
36173623 const Button = ( ) => { } ;
36183624 expect ( ReactFreshRuntime . isLikelyComponentType ( Button ) ) . toBe ( true ) ;
36193625 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 ) ;
36203632 const anon = ( ( ) => ( ) => { } ) ( ) ;
36213633 anon . displayName = 'Foo' ;
36223634 expect ( ReactFreshRuntime . isLikelyComponentType ( anon ) ) . toBe ( true ) ;
36233635
36243636 // These seem like class components.
36253637 class Btn extends React . Component { }
36263638 class PureBtn extends React . PureComponent { }
3639+ const ProxyBtn = new Proxy ( Btn , {
3640+ get ( target , property ) {
3641+ return target [ property ] ;
3642+ }
3643+ } ) ;
36273644 expect ( ReactFreshRuntime . isLikelyComponentType ( Btn ) ) . toBe ( true ) ;
36283645 expect ( ReactFreshRuntime . isLikelyComponentType ( PureBtn ) ) . toBe ( true ) ;
3646+ expect ( ReactFreshRuntime . isLikelyComponentType ( ProxyBtn ) ) . toBe ( true ) ;
36293647 expect (
36303648 ReactFreshRuntime . isLikelyComponentType (
36313649 createReactClass ( { render ( ) { } } ) ,
0 commit comments