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: correct instanceof for ModernFakeTimers and LegacyFakeTimers methods #11946

Merged
merged 4 commits into from
Oct 15, 2021

Conversation

minijus
Copy link
Contributor

@minijus minijus commented Oct 10, 2021

Closes #11660
Closes #11767
Closes #11662

Summary

Solves:

TypeError: setSystemTime is not available when not using modern timers

Test plan

All existing tests should pass.

@facebook-github-bot
Copy link
Contributor

Hi @minijus!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks!

@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2021

Codecov Report

Merging #11946 (e1ec9b7) into main (3674bbf) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11946      +/-   ##
==========================================
- Coverage   68.77%   68.76%   -0.01%     
==========================================
  Files         322      322              
  Lines       16620    16620              
  Branches     4795     4795              
==========================================
- Hits        11430    11429       -1     
- Misses       5158     5159       +1     
  Partials       32       32              
Impacted Files Coverage Δ
packages/jest-runtime/src/index.ts 56.69% <0.00%> (ø)
packages/expect/src/utils.ts 95.85% <0.00%> (-0.52%) ⬇️

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 3674bbf...e1ec9b7. Read the comment docs.

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

1 similar comment
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@minijus minijus marked this pull request as ready for review October 10, 2021 11:49
@minijus
Copy link
Contributor Author

minijus commented Oct 11, 2021

@SimenB would you have some time to have a look into this PR?

@joselcvarela
Copy link

Hello @minijus
Do you have any workaround while this is not released?
I am currently blocked by this and would like to proceed until this (or any other fix) is released.
Thank you.

@minijus
Copy link
Contributor Author

minijus commented Oct 13, 2021

Hi @joselcvarela,

I am blocked as well, had to lock version on 27.1.0. I suppose using yarn with resolves could help, but that is not a viable option in my case. Also, despite couple of tries to resolve/align identical version on my setup I was still unable to solve the issue. Then, the change to how timers are differentiated seemed like a logical move.

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

thanks!

@SimenB SimenB changed the title fix: use typeof assertion instead of instanceof to differentiate ModernFakeTimers and LegacyFakeTimers methods fix: correct instanceof for ModernFakeTimers and LegacyFakeTimers methods Oct 15, 2021
@SimenB SimenB merged commit 46c9c13 into jestjs:main Oct 15, 2021
@SimenB
Copy link
Member

SimenB commented Oct 17, 2021

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
6 participants