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: remove side-effect from runWithRealTimers #887

Merged
merged 7 commits into from
Feb 19, 2021

Conversation

ph-fritsche
Copy link
Member

What:

Rewritten runWithRealTimers and the related tests.

Why:

runWithRealTimers activated fake timers when a jest.useFakeTimers('modern') has been used in any test before.
The tests leaked setTimeout.

See #884 and #886

How:

Call jest.useRealTimers and check if any timer functions changed to determine if fake timers have been active.

Checklist:

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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 3, 2021

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 f6a6eda:

Sandbox Source
react-testing-library-examples Configuration

@codecov
Copy link

codecov bot commented Feb 3, 2021

Codecov Report

Merging #887 (97f90cc) into master (5bc9364) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #887   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           26        26           
  Lines          951       941   -10     
  Branches       288       283    -5     
=========================================
- Hits           951       941   -10     
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 5bc9364...f6a6eda. Read the comment docs.

src/helpers.js Outdated Show resolved Hide resolved
src/__tests__/helpers.js Show resolved Hide resolved
src/helpers.js Outdated Show resolved Hide resolved
@eps1lon
Copy link
Member

eps1lon commented Feb 19, 2021

Going to test this build on Material-UI first so that we have a integration test with non-jest setups.

PR: mui/material-ui#25008
CircleCI workflow (test_unit failure is unrelated): https://app.circleci.com/pipelines/github/mui-org/material-ui/38295/workflows/99cb2dd3-85be-4160-bd02-4243e1a353bc

Copy link
Member

@eps1lon eps1lon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eps1lon eps1lon merged commit ac9a6b7 into testing-library:master Feb 19, 2021
@eps1lon
Copy link
Member

eps1lon commented Feb 19, 2021

@all-contributors add @ph-fritsche for code

@ph-fritsche Thanks!

@allcontributors
Copy link
Contributor

@eps1lon

I've put up a pull request to add @ph-fritsche! 🎉

@github-actions
Copy link

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

3 participants