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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
docs site