{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/jest/issues/5171","repository_url":"https://api.github.com/repos/facebook/jest","labels_url":"https://api.github.com/repos/facebook/jest/issues/5171/labels{/name}","comments_url":"https://api.github.com/repos/facebook/jest/issues/5171/comments","events_url":"https://api.github.com/repos/facebook/jest/issues/5171/events","html_url":"https://github.com/facebook/jest/pull/5171","id":284425924,"node_id":"MDExOlB1bGxSZXF1ZXN0MTYwMDM5NTUw","number":5171,"title":"Use Lolex to implement fake timers","user":{"login":"SimenB","id":1404810,"node_id":"MDQ6VXNlcjE0MDQ4MTA=","avatar_url":"https://avatars1.githubusercontent.com/u/1404810?v=4","gravatar_id":"","url":"https://api.github.com/users/SimenB","html_url":"https://github.com/SimenB","followers_url":"https://api.github.com/users/SimenB/followers","following_url":"https://api.github.com/users/SimenB/following{/other_user}","gists_url":"https://api.github.com/users/SimenB/gists{/gist_id}","starred_url":"https://api.github.com/users/SimenB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimenB/subscriptions","organizations_url":"https://api.github.com/users/SimenB/orgs","repos_url":"https://api.github.com/users/SimenB/repos","events_url":"https://api.github.com/users/SimenB/events{/privacy}","received_events_url":"https://api.github.com/users/SimenB/received_events","type":"User","site_admin":false},"labels":[{"id":196857093,"node_id":"MDU6TGFiZWwxOTY4NTcwOTM=","url":"https://api.github.com/repos/facebook/jest/labels/CLA%20Signed%20:heavy_check_mark:","name":"CLA Signed :heavy_check_mark:","color":"009900","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/facebook/jest/milestones/8","html_url":"https://github.com/facebook/jest/milestone/8","labels_url":"https://api.github.com/repos/facebook/jest/milestones/8/labels","id":3744383,"node_id":"MDk6TWlsZXN0b25lMzc0NDM4Mw==","number":8,"title":"Jest 24","description":"","creator":{"login":"SimenB","id":1404810,"node_id":"MDQ6VXNlcjE0MDQ4MTA=","avatar_url":"https://avatars1.githubusercontent.com/u/1404810?v=4","gravatar_id":"","url":"https://api.github.com/users/SimenB","html_url":"https://github.com/SimenB","followers_url":"https://api.github.com/users/SimenB/followers","following_url":"https://api.github.com/users/SimenB/following{/other_user}","gists_url":"https://api.github.com/users/SimenB/gists{/gist_id}","starred_url":"https://api.github.com/users/SimenB/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SimenB/subscriptions","organizations_url":"https://api.github.com/users/SimenB/orgs","repos_url":"https://api.github.com/users/SimenB/repos","events_url":"https://api.github.com/users/SimenB/events{/privacy}","received_events_url":"https://api.github.com/users/SimenB/received_events","type":"User","site_admin":false},"open_issues":21,"closed_issues":8,"state":"open","created_at":"2018-10-16T21:31:36Z","updated_at":"2018-11-07T08:24:34Z","due_on":null,"closed_at":null},"comments":40,"created_at":"2017-12-25T09:04:20Z","updated_at":"2018-11-23T11:14:14Z","closed_at":null,"author_association":"COLLABORATOR","pull_request":{"url":"https://api.github.com/repos/facebook/jest/pulls/5171","html_url":"https://github.com/facebook/jest/pull/5171","diff_url":"https://github.com/facebook/jest/pull/5171.diff","patch_url":"https://github.com/facebook/jest/pull/5171.patch"},"body":"<!-- Thanks for submitting a pull request! Please provide enough information so that others can review your pull request. The two fields below are mandatory. -->\r\n\r\n<!-- Please remember to update CHANGELOG.md in the root of the project if you have not done so. -->\r\n\r\n**Summary**\r\nFixes #5165.\r\n\r\nThis PR switches out Jest's custom fake timers implementation with Lolex. This greatly simplifies things on our side (as we just need to proxy their API through the Jest object), while bringing many features:\r\n\r\n- Faking of `Date`\r\n- Faking of `requestAnimationFrame` and soon `requestIdleCallback` (https://github.com/sinonjs/lolex/issues/218)\r\n- Faking of `performance.now`\r\n- `queueMicrotask`: https://github.com/sinonjs/lolex/pull/217\r\n\r\nNote that this might mean that previously working tests now will fail because more timers are faked. We can consider allowing `jest.useFakeTimers` to get passed an array matching Lolex's `toFake` if people want to specify what to mock and what not to. See https://github.com/sinonjs/lolex/blob/master/Readme.md#var-clock--lolexinstallconfig\r\n\r\nIt brings some behavioral (aka breaking) changes as well:\r\n\r\n- `runAllPendingTimers` in Jest currently do _not_ trigger new timers scheduled while running to the last scheduled one. Lolex does (which matches what would happen in real code). Fixes #3465\r\n- `runAllImmediates` is removed. There is no way that real code could trigger an immediate without triggering other timers. Users can approximate this by doing `jest.advanceTimersByTime(0)`, but that will also trigger timers.\r\n\r\nOther breaking changes:\r\n- Callbacks scheduled using `setImmediate` or `process.nextTick` was scheduled using the real APIs in addition to the fake one, and Jest made sure that they only fired once (by keeping track). This has been removed - if you're faking time, then you're faking time\r\n- Globals that were scheduled for removal since Jest was open sourced in 2014 are removed (this landed in #7285)\r\n- Jest added spies to the fake timers automatically. We no longer do that, people need to do e.g. `jest.spyOn(global, 'setTimeout')` themselves.\r\n- Timers scheduled to trigger after `0` ms will be coerced to `1`, see https://github.com/sinonjs/lolex/issues/166\r\n- `runWithRealTimers` removed - it was undocumented and unused at FB\r\n\r\n<!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? -->\r\n\r\n**Test plan**\r\nGreen CI. No new tests are added as they'd be testing Lolex and not our own code. I've removed old tests that either didn't make sense or were testing features we've removed.\r\n\r\n<!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes UI. -->\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/jest/issues/comments/441214670","html_url":"https://github.com/facebook/jest/pull/5171#issuecomment-441214670","issue_url":"https://api.github.com/repos/facebook/jest/issues/5171","id":441214670,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0MTIxNDY3MA==","user":{"login":"AlexLomm","id":11467210,"node_id":"MDQ6VXNlcjExNDY3MjEw","avatar_url":"https://avatars2.githubusercontent.com/u/11467210?v=4","gravatar_id":"","url":"https://api.github.com/users/AlexLomm","html_url":"https://github.com/AlexLomm","followers_url":"https://api.github.com/users/AlexLomm/followers","following_url":"https://api.github.com/users/AlexLomm/following{/other_user}","gists_url":"https://api.github.com/users/AlexLomm/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexLomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexLomm/subscriptions","organizations_url":"https://api.github.com/users/AlexLomm/orgs","repos_url":"https://api.github.com/users/AlexLomm/repos","events_url":"https://api.github.com/users/AlexLomm/events{/privacy}","received_events_url":"https://api.github.com/users/AlexLomm/received_events","type":"User","site_admin":false},"created_at":"2018-11-23T11:14:14Z","updated_at":"2018-11-23T11:14:14Z","author_association":"NONE","body":"Hello, are there any updates on this issue?"}}
{"actor":{"display_login":"AlexLomm"}}