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 25, 2020
1 parent 75197db commit db12914
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.requestAnimationFrame = function(callback) {
Expand Down

0 comments on commit db12914

Please sign in to comment.