Skip to content

Use Lolex to implement Jest fake timers#7300

Closed
SimenB wants to merge 2 commits into
jestjs:masterfrom
SimenB:lolex-lite
Closed

Use Lolex to implement Jest fake timers#7300
SimenB wants to merge 2 commits into
jestjs:masterfrom
SimenB:lolex-lite

Conversation

@SimenB

@SimenB SimenB commented Oct 30, 2018

Copy link
Copy Markdown
Member

Summary

This is an alternative to #5171, that's the exact same except for the last commit, which makes sure to just mock the APIs that Jest is currently mocking, which are these: https://github.com/facebook/jest/blob/fb61bfffb803bad0c2ff9ab1798a6c4c31cb14fa/packages/jest-util/src/FakeTimers.js#L104-L113.

Hopefully, this can be merged and applied at FB, and then we can merge #5171 which will mock the rest of the timers (Date, requestAnimationFrame, performance.now etc.).

This is not meant to replace #5171.

Test plan

Tests tweaked

@codecov-io

codecov-io commented Oct 30, 2018

Copy link
Copy Markdown

Codecov Report

Merging #7300 into master will increase coverage by 5.78%.
The diff coverage is 88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #7300      +/-   ##
==========================================
+ Coverage   62.19%   67.98%   +5.78%     
==========================================
  Files         266      253      -13     
  Lines       10701     9549    -1152     
  Branches     2603        6    -2597     
==========================================
- Hits         6656     6492     -164     
+ Misses       3459     3055     -404     
+ Partials      586        2     -584
Impacted Files Coverage Δ
packages/jest-environment-jsdom/src/index.js 36.84% <ø> (ø)
packages/jest-runtime/src/index.js 73.78% <ø> (ø)
packages/jest-environment-node/src/index.js 62.5% <ø> (ø)
packages/jest-util/src/FakeTimers.js 89.65% <88%> (ø)
packages/jest-jasmine2/src/PCancelable.js 32.25% <0%> (ø) ⬆️
packages/jest-circus/runner.js 0% <0%> (ø) ⬆️
...ages/jest-jasmine2/src/expectationResultFactory.ts
packages/jest-haste-map/src/crawlers/watchman.ts
packages/expect/src/asymmetricMatchers.ts
...ckages/jest-core/src/lib/active_filters_message.ts
... and 461 more

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 5a66bbb...f163fc2. Read the comment docs.

@SimenB

SimenB commented Sep 6, 2019

Copy link
Copy Markdown
Member Author

This still broke FB horribly

@SimenB SimenB closed this Sep 6, 2019
@SimenB
SimenB deleted the lolex-lite branch September 6, 2019 14:59
@SimenB
SimenB restored the lolex-lite branch September 6, 2019 14:59
@SimenB
SimenB deleted the lolex-lite branch September 6, 2019 15:00
@github-actions

Copy link
Copy Markdown

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 May 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants