From f1fdc8b9b636e010ae5d5e737fc81a8da8f536d4 Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Mon, 12 Sep 2022 03:57:45 -0700 Subject: [PATCH] Stop polyfilling Promise in Jest tests (#34659) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/34659 We've used this Promise polyfill in Jest setup since at least 2015 ([`3ff3987`](https://github.com/facebook/react-native/commit/3ff39870ce776c653823e1733363be0401896294)), 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: - https://github.com/facebook/react-native/issues/29303 - https://github.com/facebook/jest/issues/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 --- jest/setup.js | 1 - 1 file changed, 1 deletion(-) diff --git a/jest/setup.js b/jest/setup.js index e422cb64460d95..36b922f3529dcf 100644 --- a/jest/setup.js +++ b/jest/setup.js @@ -21,7 +21,6 @@ global.performance = { now: jest.fn(Date.now), }; -global.Promise = jest.requireActual('promise'); global.regeneratorRuntime = jest.requireActual('regenerator-runtime/runtime'); global.window = global;