testing-library / dom-testing-library

🐙 Simple and complete DOM testing utilities that encourage good testing practices.
https://testing-library.com/dom
MIT License
3.26k stars 467 forks source link

feat: add `defaultIgnore` config option #1138

Closed robin-drexler closed 2 years ago

robin-drexler commented 2 years ago

What:

Adds defaultIgnore config option for byText in a similar vein to what already exists with defaultHidden for byRole.

Why: Allows to set a default ignore globally for a project.

How: Adds new config option. Also uses potentially overridden config value in places where the the default const was used before as this seemed to make sense to me.

Is this a change you'd be willing to accept? If yes, I'd be happy to add docs etc. Thanks! :)

Checklist:

codesandbox-ci[bot] commented 2 years ago

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 83a9db28511523de92dc0ae8c9a4ef44a7cc925c:

Sandbox Source
react-testing-library-examples Configuration
codecov[bot] commented 2 years ago

Codecov Report

Merging #1138 (83a9db2) into main (11fc773) will not change coverage. The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main     #1138   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           25        24    -1     
  Lines          985       985           
  Branches       320       321    +1     
=========================================
  Hits           985       985           
Flag Coverage Δ
node-12 100.00% <100.00%> (ø)
node-14 100.00% <100.00%> (ø)
node-16 100.00% <100.00%> (ø)

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

Impacted Files Coverage Δ
src/config.ts 100.00% <ø> (ø)
src/pretty-dom.js 100.00% <100.00%> (ø)
src/queries/text.ts 100.00% <100.00%> (ø)
src/suggestions.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 11fc773...83a9db2. Read the comment docs.

robin-drexler commented 2 years ago

Thanks. This was planned as a follow-up but I didn't have time.

Could you make a PR to the docs as well?

Opened the PR here: https://github.com/testing-library/testing-library-docs/pull/1088

not sure about how to release and in what order. 😅

Is that something the maintainers will do?

Thanks again!

timdeschryver commented 2 years ago

@robin-drexler You don't have to worry about that. Thanks in advance to create both PRs!

Is that something the maintainers will do?

robin-drexler commented 2 years ago

@robin-drexler You don't have to worry about that. Thanks in advance to create both PRs!

Is that something the maintainers will do?

Perfect, thanks a lot! Looking forward to seeing it land. :D

Let me know if I can do anything to support.

eps1lon commented 2 years ago

not sure about how to release and in what order. sweat_smile

I just click two buttons and change the order every so often 😅

eps1lon commented 2 years ago

@all-contributors add @robin-drexler for code

allcontributors[bot] commented 2 years ago

@eps1lon

I've put up a pull request to add @robin-drexler! :tada:

github-actions[bot] commented 2 years ago

:tada: This PR is included in version 8.14.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: