-
Notifications
You must be signed in to change notification settings - Fork 276
Closed
Description
API proposal for Jest matchers migration
This issue describes the desired API regarding Jest matchers to be included in RNTL package, and that should replace the Jest Native package matchers.
Problems with the current Jest Native matchers:
- lack of maintainers
- inconsistent RN env simulation vs RNTL
- potential version mismatch between JN and RNTL packages
- matchers frequently relying on RN implementation details prone to break in case of RN change
The goals of this initiative are as follows:
- Bring non-maintained Jest Native matchers into well-maintained RNTL project
- Tie matchers to RNTL release hence preventing matcher incompatibility, full test coverage
- Review and improve internal matcher implementation, align behaviour with RNTL
- Add missing matchers, based primarily on Jest DOM matchers
- Provide gradual migration path for existing users of @testing-library/jest-native
Matchers to keep
-
toBeOnTheScreen- feature: Jest matchers core #1454 -
toBeVisible- feat:toBeVisiblematcher #1465 -
toBeEmptyElement- feat:toBeEmptyElementmatcher #1462 -
toBeDisabled+ *toBeEnabled- feat:toBeDisabledmatcher #1469 -
toContainElementfeat:toContainElementmatcher #1495 -
toHavePropfeat:toHavePropmatcher #1477 -
toHaveStylefeat:toHaveStylematcher #1487 -
toHaveAccessibleValueImplement toHaveAccessibilityValue matcher #1496 (renamed fromtoHaveAccessibilityValueto match Jest DOM convention)
Matchers to change signature
-
toHaveTextContent- feat:toHaveTextContent()matcher #1461- exact match by default
- accept
TextMatcherOptionsas options (in line with most queries),
Matchers to add
-
toHaveDisplayValue- feat:toHaveDisplayValuematcher #1463, based on Jest DOM matcher -
toBeChecked/toBePartiallyCheckedbased on Jest DOM matcher feat:toBeChecked&toBePartiallyCheckedmatcher #1479 -
toBeSelectedfeat: implementtoBeSelectedmatcher #1488 - replacingtoHaveAccessibilityState, elements withacccessibiltyState: { selected } -
toBeBusyfeat:toBeBusy()matcher #1493 - replacingtoHaveAccessibilityState, elements withacccessibiltyState: { busy } -
toBeExpandedfeat:toBeExpandedmatcher #1497 - replacingtoHaveAccessibilityState, elements withacccessibiltyState: { expanded } -
toHaveAccessibleNamebased on Jest DOM matcher, elements with text content oraccessibilityLabelprop
Matchers to remove
toHaveAccessibilityState- to be replaced bytoBeDisabled,toBe(Partially)Checked, etc
Migration path
- Create RNTL documentation for matchers
- Create migration guide
- Expose legacy export in Jest Native package
- Update Jest Native docs that it is deprecated
- Jest Native package will allow for importing existing matchers with
legacyprefix, so that users will avoid name clashes onexpectfunction. This will be provided by Jest Native and not the RNTL in order to avoid having to managed that code inside RNTL and to keep it in the final state for potentially long time.
MattAgn, pierrezimmermannbam, mbezard, MarineP31, gstcarv and 2 more
Metadata
Metadata
Labels
No labels