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

fix(TS): add timeout to MatcherOptions type #28

Merged
merged 3 commits into from
Dec 31, 2018
Merged

fix(TS): add timeout to MatcherOptions type #28

merged 3 commits into from
Dec 31, 2018

Conversation

wKovacs64
Copy link
Contributor

What:

This change adds TypeScript support for the timeout matcher option introduced in #7.

Why:

Currently, cypress-testing-library uses the MatcherOptions interface directly from dom-testing-library, which does not have a timeout property (timeout is unique to cypress-testing-library), so using the timeout option throws a type error.

image

How:

I introduced a new CTLMatcherOptions interface for cypress-testing-library specific matcher options, aliased the MatcherOptions import from dom-testing-library to DTLMatcherOptions, and created a new type MatcherOptions, a union of the two. I also added timeout to the existing typings test (which fails without this change).

Checklist:

  • Documentation
  • Tests
  • Ready to be merged
  • Added myself to contributors table

Additional Information:

The build was failing because the commands snapshot was outdated (new commands were added to dom-testing-library more recently than cypress-testing-library has been built on CI). I fixed the snapshot in this PR so I could progress, but let me know if you'd prefer that be separated out in its own PR and I'll split them up.

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.

Perfect! Thanks!

@kentcdodds kentcdodds merged commit 18bfd99 into testing-library:master Dec 31, 2018
@wKovacs64 wKovacs64 deleted the pr/types branch December 31, 2018 03:18
@kentcdodds
Copy link
Member

🎉 This PR is included in version 2.3.5 🎉

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.

2 participants