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(cleanup): microtask flushing now supports fake timers #720

Merged
merged 1 commit into from
Jun 24, 2020

Conversation

kentcdodds
Copy link
Member

What: microtask flushing now supports fake timers

Why: So people can use fake timers in their react tests without it causing issues with React's scheduler

How:

  • Three days of total pain and anguish...
  • Detect whether we're using fake timers and if we are, advance them forward.

Checklist:

- [ ] Documentation added to the docs site N/A
- [ ] Tests N/A (really really hard to reproduce)
- [ ] Typescript definitions updated N/A

  • Ready to be merged

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jun 24, 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 403aa5c:

Sandbox Source
objective-blackwell-s1i06 Configuration
fancy-moon-2o2k6 Configuration

@codecov
Copy link

codecov bot commented Jun 24, 2020

Codecov Report

Merging #720 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #720   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          100       100           
  Branches        16        16           
=========================================
  Hits           100       100           

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 96c79f8...403aa5c. Read the comment docs.

@kentcdodds kentcdodds force-pushed the pr/support-flushing-fake-timers branch 2 times, most recently from 5aeb882 to c4378c6 Compare June 24, 2020 19:03
@kentcdodds kentcdodds force-pushed the pr/support-flushing-fake-timers branch from c4378c6 to 403aa5c Compare June 24, 2020 19:04
@kentcdodds kentcdodds merged commit 5814b29 into master Jun 24, 2020
@kentcdodds kentcdodds deleted the pr/support-flushing-fake-timers branch June 24, 2020 19:07
@kentcdodds
Copy link
Member Author

🎉 This PR is included in version 10.4.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@9still
Copy link

9still commented Sep 24, 2020

@kentcdodds Just stumbled on this - Thanks for fixing this! FYI: I just filed jestjs/jest#10555 to hopefully get jest to provide an official way to find out if fake timers are being used. Just referencing this here so if the API is added there, appropriate changes can be made.

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