mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
c42bae123d
* docs: add doc on compatibility with eslint-plugin-testing-library * Update website/docs/EslintPLluginTestingLibrary.md * Update website/docs/EslintPLluginTestingLibrary.md Co-authored-by: pierrezimmermann <pierrez@nam.tech> Co-authored-by: Michał Pierzchała <thymikee@gmail.com>
1.6 KiB
1.6 KiB
id, title
| id | title |
|---|---|
| eslint-plugin-testing-library | ESLint Plugin Testing Library Compatibility |
Most of the rules of the eslint-plugin-testing-library are compatible with this library except the followings:
-
prefer-screen-queries: there is no screen object so this rule shouldn't be used
-
prefer-user-event: userEvent requires a dom environement so it is not compatible with this library
Also, some rules have become useless, unless maybe you're using an old version of the library:
-
prefer-wait-for: the wait utility is no longer available
-
no-wait-for-empty-callback: waitFor callback param is no longer optional
To get the rule consistent-data-testid to work, you need to configure it to check the testID attribute by adding the following in your eslint config file, the testIdPattern being whichever pattern you want to enforce:
{
"testing-library/consistent-data-testid": [
2,
{
"testIdAttribute": ["testID"],
"testIdPattern": "^TestId(__[A-Z]*)?$"
}
]
}