Skip to content

Conversation

marcosvega91
Copy link
Member

What:

This change will fix issue #612.

Why:

With the version 26.0.0 of jest the jest.useFakeTimers function uses @sinonjs/fake-timers.
With this new package the property _isMockFunction is no more available.

How:

To fix the issue I have added a new check to clock property.
@testing-library/dom is now compatible with both version of useFakeTimers, the legacy and the modern one.

Checklist:

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

@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 092a72f:

Sandbox Source
snowy-shape-1tg1k Configuration

@codecov
Copy link

codecov bot commented Jun 15, 2020

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #649   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           24        24           
  Lines          574       574           
  Branches       145       145           
=========================================
  Hits           574       574           
Impacted Files Coverage Δ
src/helpers.js 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 446cce8...092a72f. 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.

Thanks!

globalObj.setTimeout &&
globalObj.setTimeout._isMockFunction &&
(globalObj.setTimeout._isMockFunction ||
typeof globalObj.setTimeout.clock !== 'undefined') &&
Copy link
Member

Choose a reason for hiding this comment

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

Sensible 👍

Copy link
Member Author

Choose a reason for hiding this comment

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

I have tried to find a different way but I didn't find

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.

Super 👏

@kentcdodds kentcdodds merged commit 167b4ac into testing-library:master Jun 15, 2020
@kentcdodds
Copy link
Member

🎉 This PR is included in version 7.15.1 🎉

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