Skip to content
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

Merged
merged 6 commits into from
Sep 7, 2020

Conversation

acatalina
Copy link
Contributor

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.

Copy link
Member

@thymikee thymikee left a 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? :)

? testID === node.props.testID
: testID.test(node.props.testID);
} catch (error) {
throw createLibraryNotSupportedError(error);
Copy link
Member

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, fair enough. Sorted

@thymikee thymikee marked this pull request as ready for review September 7, 2020 08:27
Copy link
Member

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍

@thymikee thymikee changed the title Feat: RegExp support for *AllByTestId feat: RegExp support for *ByTestId queries Sep 7, 2020
@acatalina
Copy link
Contributor Author

Awesome! Can we add this for getByTestId as well? :)

ha, you got me while I was updating the other *ByTestId and the docs

Copy link
Member

@mdjastrzebski mdjastrzebski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

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

Successfully merging this pull request may close these issues.

3 participants