-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Stop polyfilling Promise in Jest tests #34659
Conversation
Differential Revision: D39418412 fbshipit-source-id: e2b76fa91df28ce1418a487f45dbeb590a66d184
Differential Revision: D39418413 fbshipit-source-id: 7b4c96c62ada4ef7cd5231b305c926068026df38
Summary: We've used this Promise polyfill in Jest setup since at least 2015 ([`3ff3987`](facebook@3ff3987)), when native Promise implementations were either non-existent or new and unstable. We no longer need it. It causes issues with "modern" timers in Jest, as documented in: - facebook#29303 - jestjs/jest#10221 It can also obscure real issues due to its default silent handling of uncaught rejections, eg: D39418412. Changelog: [General][Changed] - Don't polyfill Promise in Jest setup Differential Revision: D39417597 fbshipit-source-id: 1773032343f914a37789c7bc43760838f2d86d31
This pull request was exported from Phabricator. Differential Revision: D39417597 |
Base commit: 4e70376 |
Base commit: 4e70376 |
This pull request was successfully merged by @robhogan in f1fdc8b. When will my fix make it into a release? | Upcoming Releases |
Summary: Jest 27 [flips defaults](https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults), making "modern" fake timers (ie, `sinonjs/fake-timers`) the default, over "legacy", which we currently use. We're not quite ready for modern timers yet, partly due to Promise polyfills (#34659), and also some internal issues with specific tests. This makes our use of legacy timers explicit in preparation for an update to Jest. A switch to modern timers may follow later. Changelog: [Internal][Changed] - Prepare for Jest 27+ by making legacy fake timer use explicit Reviewed By: jacdebug Differential Revision: D39383719 fbshipit-source-id: 6a3dc6f8547cc76f7702a5a39c9b30a184303f17
Summary: Pull Request resolved: facebook#34659 We've used this Promise polyfill in Jest setup since at least 2015 ([`3ff3987`](facebook@3ff3987)), when native Promise implementations were either non-existent or new and unstable. We no longer need it. It causes issues with "modern" timers in Jest, as documented in: - facebook#29303 - jestjs/jest#10221 It can also obscure real issues due to its default silent handling of uncaught rejections, eg: D39418412. Changelog: [General][Changed] - Don't polyfill Promise in Jest setup Reviewed By: huntie Differential Revision: D39417597 fbshipit-source-id: d12433ed66c06a402632c2e1d525aad112ef9b0c
Summary: Jest 27 [flips defaults](https://jestjs.io/blog/2021/05/25/jest-27#flipping-defaults), making "modern" fake timers (ie, `sinonjs/fake-timers`) the default, over "legacy", which we currently use. We're not quite ready for modern timers yet, partly due to Promise polyfills (facebook#34659), and also some internal issues with specific tests. This makes our use of legacy timers explicit in preparation for an update to Jest. A switch to modern timers may follow later. Changelog: [Internal][Changed] - Prepare for Jest 27+ by making legacy fake timer use explicit Reviewed By: jacdebug Differential Revision: D39383719 fbshipit-source-id: 6a3dc6f8547cc76f7702a5a39c9b30a184303f17
This is a breaking change, any hint how we should handle it now? |
This is causing my tests that were passing with "jest": "^26.6.3" to error out with error.
Please is there a fix for this |
Summary:
We've used this Promise polyfill in Jest setup since at least 2015 (
3ff3987
), when native Promise implementations were either non-existent or new and unstable. We no longer need it.It causes issues with "modern" timers in Jest, as documented in:
global.Promise
replacement in Jest setup causing problems. #29303It can also obscure real issues due to its default silent handling of uncaught rejections, eg: D39418412.
Changelog:
[General][Changed] - Don't polyfill Promise in Jest setup
Differential Revision: D39417597