-
Notifications
You must be signed in to change notification settings - Fork 273
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
feat: RegExp support for *ByTestId queries #535
feat: RegExp support for *ByTestId queries #535
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! Can we add this for getByTestId
as well? :)
src/helpers/getByAPI.js
Outdated
? testID === node.props.testID | ||
: testID.test(node.props.testID); | ||
} catch (error) { | ||
throw createLibraryNotSupportedError(error); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We only use createLibraryNotSupportedError
when importing something from react-native
. No need for this try/catch here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, fair enough. Sorted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
ha, you got me while I was updating the other *ByTestId and the docs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Summary
All *AllByTestId queries support a RegExp matcher.
We are currently preparing to migrate to the the v7 of the testing library. In our tests, the lack of this feature is a massive disadvantage for our migration as we relay in this functionality quite often.
Test plan
Tests added following preexisting tests.