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

Added explicit error message for Promises passed to getWindowFromNode #646

Merged
merged 2 commits into from
Jun 15, 2020
Merged

Added explicit error message for Promises passed to getWindowFromNode #646

merged 2 commits into from
Jun 15, 2020

Conversation

JoshuaKGoldberg
Copy link
Contributor

What:

Added a nice explicit error message for the case in #609 of a Promise or Promise-like passed to a function that expects a DOM node.

Why:

Better error messages = happier users! 💝

How:

Per #609 (comment), checked if node.then instanceof Function.

Checklist:

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

I'm not attached to this particular error message, if a reviewer can think of something better that'd be nice.

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 15, 2020

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 2a42a49:

Sandbox Source
elastic-silence-hvzlz Configuration

@codecov
Copy link

codecov bot commented Jun 15, 2020

Codecov Report

Merging #646 into master will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #646   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines          565       574    +9     
  Branches       141       145    +4     
=========================================
+ Hits           565       574    +9     
Impacted Files Coverage Δ
src/helpers.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 dbc1b3e...2a42a49. 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.

Looking good! Just one thing.

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.

Great! Thank you!

@kentcdodds kentcdodds merged commit 2a51345 into testing-library:master Jun 15, 2020
@JoshuaKGoldberg JoshuaKGoldberg deleted the pr/unable-to-find-promise branch June 15, 2020 05:10
@kentcdodds
Copy link
Member

@all-contributors please add @JoshuaKGoldberg for code and tests

@allcontributors
Copy link
Contributor

@kentcdodds

I've put up a pull request to add @JoshuaKGoldberg! 🎉

@kentcdodds
Copy link
Member

🎉 This PR is included in version 7.15.0 🎉

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.

" Unable to find the "window" object for the given node." when node is a Promise
2 participants