Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

feat: add a jest preset for more confidence #10

Merged
merged 1 commit into from
Apr 28, 2019

Conversation

bcarroll22
Copy link
Collaborator

@bcarroll22 bcarroll22 commented Apr 26, 2019

What:

Change how the core types are mocked, so that it can be aligned with the proposed jest-native preset.

Why:

I believe this will give developers more confidence in their tests. When you debug() a tree in this model, you'll see the "primitive" types that will be included in the react-native lean core.

I believe this will make much more sense to developers creating apps, and ultimately hides implementation details of how React Native creates the native components they're asking for.

We already filter the types of elements you can query for on purpose, I believe this makes that filter better. We've always done this on purpose to align to the guiding principles of testing-library, and this digs in on that belief more than ever. It also makes debug output more aligned with what developers expect.

How:

My vision for this library is to gravitate toward only showing in snapshots and debug() output the closest thing resembling the DOM in the web. This mocks the components I (and the RN core team) believe are those components.

Ultimately, I think a few more than just the lean core will need to be mocked (one example would be Picker. I see why they don't want it in the core, but i think form components are basic building blocks developers will want to target in tests.

Checklist:

  • Documentation added to the
    docs site
  • Typescript definitions updated
  • Tests
  • Ready to be merged

@bcarroll22 bcarroll22 requested a review from TAGraves April 26, 2019 15:30
@codecov-io
Copy link

codecov-io commented Apr 28, 2019

Codecov Report

Merging #10 into next will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@         Coverage Diff         @@
##           next    #10   +/-   ##
===================================
  Coverage   100%   100%           
===================================
  Files        23     24    +1     
  Lines       287    284    -3     
  Branches     49     49           
===================================
- Hits        287    284    -3
Impacted Files Coverage Δ
src/lib/config.js 100% <ø> (ø)
src/lib/matches.js 100% <ø> (ø)
src/lib/wait-for-element-to-be-removed.js 100% <ø> (ø)
src/lib/queries/a11y-hint.js 100% <ø> (ø)
src/lib/wait.js 100% <ø> (ø)
src/lib/get-node-text.js 100% <ø> (ø)
src/lib/get-queries-for-element.js 100% <ø> (ø)
src/lib/helpers.js 100% <ø> (ø)
src/lib/queries/a11y-traits.js 100% <ø> (ø)
src/lib/queries/a11y-label.js 100% <ø> (ø)
... and 17 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 49f2b0d...f2172a8. Read the comment docs.

@bcarroll22 bcarroll22 changed the title feat: change the mocked core components feat: add a jest preset for more confidence Apr 28, 2019
@bcarroll22 bcarroll22 added breaking change enhancement New feature or request labels Apr 28, 2019
@bcarroll22 bcarroll22 force-pushed the pr/mock-lean-core-types branch from 4e97f94 to 27dd1ac Compare April 28, 2019 02:45
@bcarroll22 bcarroll22 force-pushed the pr/mock-lean-core-types branch from 27dd1ac to f2172a8 Compare April 28, 2019 04:51
@bcarroll22 bcarroll22 merged commit d377026 into next Apr 28, 2019
@bcarroll22 bcarroll22 deleted the pr/mock-lean-core-types branch April 28, 2019 04:56
@bcarroll22
Copy link
Collaborator Author

🎉 This PR is included in version 3.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants