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

add tests to prove jest useFakeTimers is supported #641

Merged
merged 2 commits into from Jul 30, 2021

Conversation

chris110408
Copy link
Contributor

@chris110408 chris110408 commented Jun 21, 2021

What:
Add test to show the jest.useFakeTimers() which use with advancing the timers has been supported. However, the reason why dom-testing-library implement the feature( jest.useFakeTimers() work automagically without explicitly advancing the timers) is not clear, a further investigation may continue.

Why:
related to #631,

How:
we add tests use jest.useFakeTimers() (wrap with try-catch and finally to make sure the fake timers would not break other tests when test fail,) in dom, native, and server. all test success run

Checklist:

  • Documentation updated
  • Tests
  • Ready to be merged
  • Added myself to contributors table

@codecov
Copy link

codecov bot commented Jun 21, 2021

Codecov Report

Merging #641 (a461f78) into main (a54eeb3) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #641   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           15        15           
  Lines          235       235           
  Branches        33        33           
=========================================
  Hits           235       235           

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 a54eeb3...a461f78. Read the comment docs.

@chris110408
Copy link
Contributor Author

@mpeyper Sorry I had a merge conflict and I am fixing it by creating this new pull request 😸
try-catch-finally has been added and the same tests have been used for dom native and server. I think it is ready for merge.
The only thing on those checklist is Added myself to contributors table. I am not sure how to do is Added myself to contributors table.

# Conflicts:
#	src/dom/__tests__/asyncHook.test.ts
#	src/native/__tests__/asyncHook.test.ts
#	src/server/__tests__/asyncHook.test.ts
@mpeyper
Copy link
Member

mpeyper commented Jul 30, 2021

I've updated the test to use the new mutil-renderer tests. I've also moved them into their own file specifically for fake timers so we can expand it further when looking closer at #631.

Thanks again for the effort on this so far, and sorry it took me so long to get back to this.

@all-contributors please add @chris110408 for test

@allcontributors
Copy link
Contributor

@mpeyper

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

@mpeyper mpeyper merged commit 7273ba4 into testing-library:main Jul 30, 2021
@github-actions
Copy link

🎉 This PR is included in version 7.0.2 🎉

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.

None yet

2 participants