Skip to content

feat: warn when the test environment fake timers change unexpectedly #832

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

Merged
merged 1 commit into from
Nov 19, 2020

Conversation

kentcdodds
Copy link
Member

What: feat: warn when the test environment fake timers change unexpectedly

Why: Closes: #830

How: For every iteration of waitFor, it checks whether the state of fake timers has changed and if it has, it rejects with an error. Also supports the showOriginalStackTrace config option.

Checklist:

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

@codesandbox-ci
Copy link

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 9442fb0:

Sandbox Source
react-testing-library-examples Configuration
react-testing-library demo Issue #830

@codecov
Copy link

codecov bot commented Nov 18, 2020

Codecov Report

Merging #832 (9442fb0) into master (9494fdc) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #832   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines          923       934   +11     
  Branches       282       286    +4     
=========================================
+ Hits           923       934   +11     
Impacted Files Coverage Δ
src/wait-for.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 9494fdc...9442fb0. Read the comment docs.

@kentcdodds kentcdodds merged commit e3fc7f3 into master Nov 19, 2020
@kentcdodds kentcdodds deleted the pr/wait-for-warning branch November 19, 2020 14:40
@kentcdodds
Copy link
Member Author

@all-contributors please add @nickmccurdy for review

@allcontributors
Copy link
Contributor

@kentcdodds

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

@github-actions
Copy link

🎉 This PR is included in version 7.28.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.

waitFor errors with a weird error if a test using fake timers stops (because of an error for example) while it's waiting
2 participants