Skip to content

feat: allow TextMatch to be any non-nullable type #829

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

Merged
merged 1 commit into from
Nov 18, 2020

Conversation

nickserv
Copy link
Member

What: TextMatch is allowed to be of any non-nullable type (any except undefined and null)

Why: Error messages show confusing failed method calls instead of attempting to treat the TextMatch as a string implicitly (fixes #826)

How: Call String() whenever the TextMatch matcher isn't a RegExp or Function (allowing it to be any instead of string)

Checklist:

  • Documentation added to the
    docs site
  • Tests
  • Typescript definitions updated
  • Ready to be merged

@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 30f3880:

Sandbox Source
react-testing-library-examples Configuration

@codecov
Copy link

codecov bot commented Nov 18, 2020

Codecov Report

Merging #829 (30f3880) into master (54fe9ba) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #829   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines          922       922           
  Branches       281       281           
=========================================
  Hits           922       922           
Impacted Files Coverage Δ
src/matches.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 54fe9ba...30f3880. Read the comment docs.

Copy link
Member

@kentcdodds kentcdodds left a comment

Choose a reason for hiding this comment

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

LGTM 👍 Thanks!

@kentcdodds kentcdodds merged commit 9b688f8 into master Nov 18, 2020
@kentcdodds kentcdodds deleted the textmatch-non-nullable branch November 18, 2020 05:16
@github-actions
Copy link

🎉 This PR is included in version 7.27.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nickserv
Copy link
Member Author

I'll work on the docs next

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

Successfully merging this pull request may close these issues.

Cryptic error message when passing a number to getByText
2 participants