Skip to content

feat: simplified the getByText error message #945

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

Conversation

itsik-avidan
Copy link

What:
Updated the error message returned from the getByText query to be more descriptive
#732

Why:

How:

Checklist:

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

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 5, 2021

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 a653961:

Sandbox Source
react-testing-library-examples Configuration

expect(() => getByText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element with the text: LucyRicardo. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
"Unable to find an element using the provided matcher.The matcher is - LucyRicardo This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
Copy link
Member

Choose a reason for hiding this comment

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

This is less descriptive to me. Before I knew it was "text". Now it sounds like there's named matcher called "LucyRicardo" when it's just text.

@eps1lon eps1lon added the enhancement New feature or request label Jun 3, 2021
@eps1lon eps1lon changed the title task: simplified the getByText error message feat: simplified the getByText error message Jun 3, 2021
@codecov
Copy link

codecov bot commented Jun 3, 2021

Codecov Report

Merging #945 (a653961) into main (ffc8f26) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #945   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines          953       957    +4     
  Branches       289       293    +4     
=========================================
+ Hits           953       957    +4     
Flag Coverage Δ
node-10.14.2 100.00% <100.00%> (ø)
node-12 100.00% <100.00%> (ø)
node-14 100.00% <100.00%> (ø)
node-15 100.00% <100.00%> (ø)
node-16 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/queries/text.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 ffc8f26...a653961. Read the comment docs.

@eps1lon eps1lon linked an issue Jun 3, 2021 that may be closed by this pull request
@eps1lon
Copy link
Member

eps1lon commented Aug 25, 2021

Closing since this PR appears to be abandoned

@eps1lon eps1lon closed this Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sub-optimal error message when using text matcher functions
2 participants