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
This commit is contained in:
Rob Hogan
2022-09-12 03:57:45 -07:00
committed by Facebook GitHub Bot
parent feead8f299
commit f1fdc8b9b6
-1
View File
@@ -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;