-
Notifications
You must be signed in to change notification settings - Fork 273
refactor: component tree dead code #1403
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
Conversation
Nice cleaning! Are you on a refactoring streak? 😄 |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1403 +/- ##
==========================================
- Coverage 96.85% 96.79% -0.06%
==========================================
Files 51 51
Lines 3461 3404 -57
Branches 519 504 -15
==========================================
- Hits 3352 3295 -57
Misses 109 109
☔ View full report in Codecov by Sentry. |
@MattAgn I've managed to find some time and energy to work on User Event |
Oh great news! On my end, I struggle to find time for fireEvent.press 😅 fortunately @pierrezimmermannbam is here! |
This PR has been released in v12.1.2 🚀 |
@mdjastrzebski thanks for the work. I'm looking into our dependency update and why the tests are failing from |
@BillyBlaze thank you for reaching out with your issue. The root cause why RNTL internal code change caused test failures for you is that your test relied on spying on global React primitives, like We do not consider this to be a breaking change, as our public API remained the same and we do not recommend such testing patterns as they result in fragile testing code that is dependent on tested components internal details rather than public API. Per our guiding principle:
The recommended way is to use the public interface: props, event handlers and rendered output of your components to detect expected state behaviors and state changes instead of internal implementation details like internal state, etc. I hope that clarifies our stance in this regards and allows you to write more resilient tests. |
….2 (#2445) [](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [@testing-library/react-native](https://callstack.github.io/react-native-testing-library) ([source](https://togithub.com/callstack/react-native-testing-library)) | [`12.0.1` -> `12.1.2`](https://renovatebot.com/diffs/npm/@testing-library%2freact-native/12.0.1/12.1.2) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>callstack/react-native-testing-library</summary> ### [`v12.1.2`](https://togithub.com/callstack/react-native-testing-library/releases/tag/v12.1.2) [Compare Source](https://togithub.com/callstack/react-native-testing-library/compare/v12.1.1...v12.1.2) #### What's Changed #### Fixes - fix: pointer events evaluation by [@​mdjastrzebski](https://togithub.com/mdjastrzebski) in [https://github.com/callstack/react-native-testing-library/pull/1395](https://togithub.com/callstack/react-native-testing-library/pull/1395) - fix: non-editable wrapped TextInput events by [@​TMaszko](https://togithub.com/TMaszko) in [https://github.com/callstack/react-native-testing-library/pull/1385](https://togithub.com/callstack/react-native-testing-library/pull/1385) - fix: support `onXxx` event name for TextInput event checks by [@​mdjastrzebski](https://togithub.com/mdjastrzebski) in [https://github.com/callstack/react-native-testing-library/pull/1404](https://togithub.com/callstack/react-native-testing-library/pull/1404) #### Docs, Chores, etc - docs: add config example for pnpm by [@​yjose](https://togithub.com/yjose) in [https://github.com/callstack/react-native-testing-library/pull/1400](https://togithub.com/callstack/react-native-testing-library/pull/1400) - chore: move/remove deprecation functions by [@​mdjastrzebski](https://togithub.com/mdjastrzebski) in [https://github.com/callstack/react-native-testing-library/pull/1402](https://togithub.com/callstack/react-native-testing-library/pull/1402) - refactor: component tree dead code by [@​mdjastrzebski](https://togithub.com/mdjastrzebski) in [https://github.com/callstack/react-native-testing-library/pull/1403](https://togithub.com/callstack/react-native-testing-library/pull/1403) - refactor: `fireEvent` cleanup by [@​mdjastrzebski](https://togithub.com/mdjastrzebski) in [https://github.com/callstack/react-native-testing-library/pull/1401](https://togithub.com/callstack/react-native-testing-library/pull/1401) #### New Contributors - [@​yjose](https://togithub.com/yjose) made their first contribution in [https://github.com/callstack/react-native-testing-library/pull/1400](https://togithub.com/callstack/react-native-testing-library/pull/1400) 👏 - [@​TMaszko](https://togithub.com/TMaszko) made their first contribution in [https://github.com/callstack/react-native-testing-library/pull/1385](https://togithub.com/callstack/react-native-testing-library/pull/1385) 👏 **Full Changelog**: callstack/react-native-testing-library@v12.1.1...v12.1.2 ### [`v12.1.1`](https://togithub.com/callstack/react-native-testing-library/releases/tag/v12.1.1) [Compare Source](https://togithub.com/callstack/react-native-testing-library/compare/v12.1.0...v12.1.1) #### What's Changed #### Fixes - fix: remove incorrect dependencies by [@​mdjastrzebski](https://togithub.com/mdjastrzebski) in [https://github.com/callstack/react-native-testing-library/pull/1399](https://togithub.com/callstack/react-native-testing-library/pull/1399) **Full Changelog**: callstack/react-native-testing-library@v12.1.0...v12.1.1 ### [`v12.1.0`](https://togithub.com/callstack/react-native-testing-library/releases/tag/v12.1.0) [Compare Source](https://togithub.com/callstack/react-native-testing-library/compare/v12.0.1...v12.1.0) #### What's Changed ##### Improvements - feat: Render element tree in query error messages by [@​stevehanson](https://togithub.com/stevehanson) in [https://github.com/callstack/react-native-testing-library/pull/1378](https://togithub.com/callstack/react-native-testing-library/pull/1378) ##### Bugfixes - Proper stack trace for findBy\* and findAllBy\* queries by [@​mdjastrzebski](https://togithub.com/mdjastrzebski) in [https://github.com/callstack/react-native-testing-library/pull/1394](https://togithub.com/callstack/react-native-testing-library/pull/1394) #### New Contributors - [@​stevehanson](https://togithub.com/stevehanson) made their first contributions in [#​1377](https://togithub.com/callstack/react-native-testing-library/issues/1377), [#​1378](https://togithub.com/callstack/react-native-testing-library/issues/1378) and [#​1390](https://togithub.com/callstack/react-native-testing-library/issues/1390) 👏 ##### Chores, docs, deps, etc - Fix broken link in contributing.md by [@​stevehanson](https://togithub.com/stevehanson) in [https://github.com/callstack/react-native-testing-library/pull/1377](https://togithub.com/callstack/react-native-testing-library/pull/1377) - chore: update deps 2023-04-04 by [@​mdjastrzebski](https://togithub.com/mdjastrzebski) in [https://github.com/callstack/react-native-testing-library/pull/1380](https://togithub.com/callstack/react-native-testing-library/pull/1380) - Fix typo in "derived" in v12 migration guide by [@​CodingItWrong](https://togithub.com/CodingItWrong) in [https://github.com/callstack/react-native-testing-library/pull/1376](https://togithub.com/callstack/react-native-testing-library/pull/1376) - chore: fix migration guide role prop naming by [@​mdjastrzebski](https://togithub.com/mdjastrzebski) in [https://github.com/callstack/react-native-testing-library/pull/1382](https://togithub.com/callstack/react-native-testing-library/pull/1382) - fix: "Edit this Page" link in docs results in 404 by [@​stevehanson](https://togithub.com/stevehanson) in [https://github.com/callstack/react-native-testing-library/pull/1390](https://togithub.com/callstack/react-native-testing-library/pull/1390) - refactor: remove stale tests by [@​mdjastrzebski](https://togithub.com/mdjastrzebski) in [https://github.com/callstack/react-native-testing-library/pull/1392](https://togithub.com/callstack/react-native-testing-library/pull/1392) - chore: experiments app by [@​mdjastrzebski](https://togithub.com/mdjastrzebski) in [https://github.com/callstack/react-native-testing-library/pull/1391](https://togithub.com/callstack/react-native-testing-library/pull/1391) **Full Changelog**: callstack/react-native-testing-library@v12.0.1...v12.1.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/dooboolab-community/react-native-iap). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS45OC40IiwidXBkYXRlZEluVmVyIjoiMzUuMTMxLjAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIn0=--> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Summary
Scope:
component-tree.ts
Switch
todetectHostComponentNames
and React Native API assumptions testscomponent-tree.ts
functions:getHostSelf
,getCompositeParentOfType
,isHostElementForType
.Test plan
N/A