Skip to content

Commit

Permalink
Jest setup: Stop polyfilling Promise.
Browse files Browse the repository at this point in the history
It looks like this line was introduced in 3ff3987, in 2015, and it
has remained in a similar form since then. I haven't found any
explanation for it.

At jestjs/jest#10221 [1], a core Jest maintainer says,

"""
As an aside, one should never replace `global.Promise` [...]. E.g.
when using `async-await` you will always get the native `Promise`
regardless of the value of `global.Promise`.
"""

jestjs/jest#10221 is one issue this line has raised, for anyone
using the latest features of Jest to test async code in their React
Native projects.

[1] jestjs/jest#10221 (comment)

Fixes: facebook#29303
  • Loading branch information
chrisbobbe committed Aug 24, 2020
1 parent 86cad7d commit 94ce6dd
Showing 1 changed file with 0 additions and 1 deletion.
1 change: 0 additions & 1 deletion jest/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jest.requireActual('../Libraries/polyfills/error-guard');

global.__DEV__ = true;

global.Promise = jest.requireActual('promise');
global.regeneratorRuntime = jest.requireActual('regenerator-runtime/runtime');

global.requestAnimationFrame = function(callback) {
Expand Down

0 comments on commit 94ce6dd

Please sign in to comment.