-
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
[POC] Custom test renderer #1669
Conversation
# Conflicts: # package.json # src/__tests__/__snapshots__/render-debug.test.tsx.snap # yarn.lock
# Conflicts: # package.json # src/fire-event.ts # src/helpers/component-tree.ts # src/matchers/__tests__/to-be-checked.test.tsx # src/matchers/__tests__/to-be-partially-checked.test.tsx # src/render.tsx # src/user-event/utils/dispatch-event.ts # yarn.lock
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1669 +/- ##
==========================================
- Coverage 95.51% 93.48% -2.04%
==========================================
Files 99 94 -5
Lines 5400 5435 +35
Branches 857 886 +29
==========================================
- Hits 5158 5081 -77
- Misses 242 354 +112 ☔ View full report in Codecov by Sentry. |
The fact that composite components aren't there anymore makes I wonder if we should consider removing it completely? Or maybe making it deprecated at first to ease migration but still aim at removing it in the long term. I don't think
Overall it would be a very difficult migration but that would make user's tests better in the end I think so I do think it's a reasonable option. Wdyt @mdjastrzebski @MattAgn ? |
I think we need to keep I deeply care about great many RN developers that wrote and/or now maintain large test bases full of Regarding User Event requiring fake timers, I think that many people are actually using them without fake timers, accepting the delay on |
Closing as replaced by #1705. |
Summary
Experimental test renderer replacing React Test Renderer, which is being deprecated.
Overview
The new renderer (React Native Test Renderer?) is a simple renderer created using
react-reconciler
package. It operates only on host elements and does not expose composite elements at all. It's still very simple and event propagation is still handled by RNTL.Details
Pressable
/Touchable
whereonPress
exists only on composite level, while on host element level it'sonResponderGrant
+onResponderRelease
pair. In order to minimise the impact on the existing testsfireEvent.press
actually callsonResponderGrant
+onResponderRelease
to triggeronPress
in such case.UNSAFE_xxx
queries (*byType
and*byProps
) and props (UNSAFE_container
) no longer return composite elements, and can be either removed (high time) or kept but withoutUNSAFE_
prefix as they are now safe.Text
component is now automatically detected on renderer error and triggers a throw, as it would in React Native renderer.Test status
All tests passing. Some tests had been disabled due to no longer being relevant.