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 6e39827 commit 98a12ee
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion android/com/facebook/react/react-native/maven-metadata.xml
Expand Up @@ -7,6 +7,6 @@
<versions>
<version>0.61.5</version>
</versions>
<lastUpdated>20200825180753</lastUpdated>
<lastUpdated>20200825182101</lastUpdated>
</versioning>
</metadata>
@@ -1 +1 @@
aa57f1b2f064dca23b4b122f2715a941
1f448be785da145276a61b82175013d2
@@ -1 +1 @@
3a98ee4afadae726bc5c9805698318f8897bbfca
070de441ae93253fc1f611eb8048757028197644
1 change: 0 additions & 1 deletion jest/setup.js
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 98a12ee

Please sign in to comment.