-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(v13): remove detect host component names #1697
refactor(v13): remove detect host component names #1697
Conversation
Would be great to get rid of that indirection between incomplete RN core mocks and RNTL |
RN mocks are a bigger topic that has to be coordinated closely with the RN team, as the mocks reside in the RN repo. Moreover, any changes to mock level/structure can potentially make user test bases fail. In the due time (~ RNTL v14 with the new renderer) I plan to prepare an RFC to RN core team about recommended mock changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I completely agree on this, this library is anyway coupled with RN mocks so it feels like unnecessary complexity in the end
hi, just a quick feedback that this is missing from the v13.0.0-alpha.1 release notes, not sure if intended. I'm eager to try it to see tests performance impact |
@rtrembecky good catch. Added it. I would appreciate any feedback on v13 in your project: migration, broken tests, perf 🙏 |
I've done a very quick testing on test suite of one of our RN libs - it went through fine. but unfortunately I didn't see any noticeable performance gain, which is what I'm currently interested in. (the biggest culprits for us are probably barrel files and transformation of RN flow-typed files... not related to this issue) |
@rtrembecky Hmmm, that's a bit weird. I would expecte 10-20% speed improvement as in #1579. Can you share some stats? Total run time before/after, number of tests, etc? |
Here are the stats for RNTL own test base Before (7905bb5):
After (13bc78a):
|
running a single RN test on my M1 Max takes 35s even it it's skipped, saying something about our setup - I think it's the barrel files handling (jestjs/jest#11234), so RNTL performance is most probably overshadowed. I will definitely come back, if I manage to solve this, to report the performance impact. |
Summary
Remove host component name detection for v13+ release. Instead we hardcode the expected host component names & add relevant tests to make sure our
isHostXxx
function work correctly for RN components.Rationale:
RCTView
/RCTText
toView
/Text
. In reality that past change wasn't only about the name, but also the level at which components are mocked, as the new mocks no longer execute JS code for View, Text.aria-*
props names, or handling pressability forText
/TextInput
, as that part of the code got removed by the RN mocks. Therefore, potentially any RN mocks change will result in RNTL needing to adapt to these changes beyond the name.Test plan
All tests should pass.