Skip to content

Commit

Permalink
Stop polyfilling Promise in Jest tests (facebook#34659)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
robhogan authored and OlimpiaZurek committed May 22, 2023
1 parent 88cd7a7 commit 93e9343
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion jest/setup.js
Expand Up @@ -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;

Expand Down

0 comments on commit 93e9343

Please sign in to comment.