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

refactor: add toBeEmptyElement assertion #111

Conversation

joaoGabriel55
Copy link
Contributor

@joaoGabriel55 joaoGabriel55 commented Sep 22, 2022

What:

closes #102.

This PR consists in create a new assertion called toBeEmptyElement and make current assertion toBeEmpty deprecated.

Why:

Jest-Extended has an assertion named the same as jest-native's one:

-> https://github.com/jest-community/jest-extended#tobeempty
-> https://github.com/testing-library/jest-native#tobeempty

When both libs are used in the same project, the version of jest-extended overwrites the one from jest-native.

@testing-library/jest-dom has had the same problem testing-library/jest-dom#216 and they renamed their matcher to toBeEmptyDOMElement .

How:

Just was created a new assertion called toBeEmptyElement that have the same behavior of current assertion toBeEmpty.

Checklist:

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

src/index.js Outdated Show resolved Hide resolved
src/to-be-empty.js Outdated Show resolved Hide resolved
Copy link
Collaborator

@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.

Thank you for contribution @joaoGabriel55. I've left a few minor comments to polish things up.

@mdjastrzebski
Copy link
Collaborator

Pls also add updated name to our TS definitions: https://github.com/testing-library/jest-native/blob/main/extend-expect.d.ts

@codecov
Copy link

codecov bot commented Sep 22, 2022

Codecov Report

Merging #111 (c95df07) into main (044229b) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #111   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            8         8           
  Lines          140       149    +9     
  Branches        44        45    +1     
=========================================
+ Hits           140       149    +9     
Flag Coverage Δ
node-14 100.00% <100.00%> (ø)
node-16 100.00% <100.00%> (ø)
node-18 100.00% <100.00%> (ø)

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

Impacted Files Coverage Δ
src/to-be-empty-element.js 100.00% <100.00%> (ø)
src/utils.js 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mdjastrzebski
Copy link
Collaborator

@joaoGabriel55 pls also duplicate tests for old and new name, so that our codecov overload is happy ;-)

extend-expect.d.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@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.

Looks good!

@mdjastrzebski mdjastrzebski merged commit d38fc80 into testing-library:main Sep 26, 2022
@mdjastrzebski
Copy link
Collaborator

@joaoGabriel55 thank you for your contribution 👍🏻

@github-actions
Copy link

🎉 This PR is included in version 4.0.13 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

ToBeEmpty assertion in jest-native is also used in jest-extended
2 participants