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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve runAllTimers doc (it exhausts the micro-task queue) #8031

Merged
merged 2 commits into from Mar 4, 2019

Conversation

@dorian-marchal
Copy link
Contributor

dorian-marchal commented Mar 3, 2019

Updates jest.runAllTimers() documentation to state that it also
exhausts the micro-task queue (this is the case since commit 9d17ea9).

Summary

Since #3915, jest.runAllTimers() is a superset of jest.runAllTicks(), but this is not explained in the documentation.
Maybe this is implicit, but this was not clear to me until I came across #3915, so this is why I suggest this change. 馃檪

@facebook-github-bot

This comment has been minimized.

Copy link

facebook-github-bot commented Mar 3, 2019

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up 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 the corporate CLA signed.

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

docs/JestObjectAPI.md Outdated Show resolved Hide resolved
@SimenB SimenB requested a review from rickhanlonii Mar 3, 2019
Copy link
Collaborator

SimenB left a comment

Thanks! Left an inline comment.

Can you also update the changelog, and the versioned docs?

image

@facebook-github-bot

This comment has been minimized.

Copy link

facebook-github-bot commented Mar 3, 2019

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

Updates `jest.runAllTimers()` documentation to state that it also
exhausts the micro-task queue (this is the case since commit 9d17ea9).
@dorian-marchal

This comment has been minimized.

Copy link
Contributor Author

dorian-marchal commented Mar 3, 2019

Updated changelog and versionned docs. 馃摑

@SimenB
SimenB approved these changes Mar 3, 2019
Copy link
Collaborator

SimenB left a comment

Thanks!

@SimenB SimenB requested a review from thymikee Mar 3, 2019
@codecov-io

This comment has been minimized.

Copy link

codecov-io commented Mar 3, 2019

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #8031   +/-   ##
=======================================
  Coverage   63.31%   63.31%           
=======================================
  Files         263      263           
  Lines       10266    10266           
  Branches     2098     2098           
=======================================
  Hits         6500     6500           
  Misses       3273     3273           
  Partials      493      493

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 4c25942...a29710d. Read the comment docs.

@@ -428,9 +428,9 @@ When this API is called, all pending micro-tasks that have been queued via `proc

### `jest.runAllTimers()`

Exhausts the **macro**-task queue (i.e., all tasks queued by `setTimeout()`, `setInterval()`, and `setImmediate()`).
Exhausts both the **macro**-task queue (i.e., all tasks queued by `setTimeout()`, `setInterval()`, and `setImmediate()`) and the **micro**-task queue (usually interfaced in node via `process.nextTick`).

This comment has been minimized.

Copy link
@thymikee

thymikee Mar 3, 2019

Collaborator

While we're at enumerating examples, let's add Promises next to process.nextTick as they're used way more often and

This comment has been minimized.

Copy link
@SimenB

SimenB Mar 3, 2019

Collaborator

By default, we don't exhaust it though - only if you've replaced Promise with a fake one

This comment has been minimized.

Copy link
@thymikee

thymikee Mar 3, 2019

Collaborator

Oh, that's a good point 馃檲 we should at some point tho

This comment has been minimized.

Copy link
@SimenB

SimenB Mar 3, 2019

Collaborator
@SimenB SimenB merged commit 5ba35be into facebook:master Mar 4, 2019
12 checks passed
12 checks passed
ci/circleci: lint-and-typecheck Your tests passed on CircleCI!
Details
ci/circleci: test-browser Your tests passed on CircleCI!
Details
ci/circleci: test-jest-circus Your tests passed on CircleCI!
Details
ci/circleci: test-node-10 Your tests passed on CircleCI!
Details
ci/circleci: test-node-11 Your tests passed on CircleCI!
Details
ci/circleci: test-node-6 Your tests passed on CircleCI!
Details
ci/circleci: test-node-8 Your tests passed on CircleCI!
Details
ci/circleci: test-or-deploy-website Your tests passed on CircleCI!
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
deploy/netlify Deploy preview ready!
Details
facebook.jest #20190303.47 succeeded
Details
@dorian-marchal dorian-marchal deleted the dorian-marchal:doc-updates-runAllTimers-doc branch Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can鈥檛 perform that action at this time.