From 64656776ef739ba5e8e96a1acc5d94dc300fcac6 Mon Sep 17 00:00:00 2001 From: Rob Hogan Date: Sun, 11 Sep 2022 14:33:27 -0700 Subject: [PATCH] Stop polyfilling Promise in Jest tests Summary: 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 Differential Revision: D39417597 fbshipit-source-id: 1773032343f914a37789c7bc43760838f2d86d31 --- jest/setup.js | 1 - 1 file changed, 1 deletion(-) diff --git a/jest/setup.js b/jest/setup.js index e422cb64460..36b922f3529 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;