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 86cad7d commit 155a4f7
Show file tree
Hide file tree
Showing 16 changed files with 114 additions and 1 deletion.
Binary file not shown.
@@ -0,0 +1 @@
b4a50e88c4cafb0680ed42a91156f651
@@ -0,0 +1 @@
f6f236d31d8e2bb22961109023579dde4a6fdf0c
Binary file not shown.
@@ -0,0 +1 @@
672da7aa1dec30a2fe89b193849cf19f
@@ -0,0 +1 @@
d21098c434fd78030c32c90359848fed9a14985c
Binary file not shown.
@@ -0,0 +1 @@
d5cfce81157092c7c55c029b68718d6e
@@ -0,0 +1 @@
e368e7a989b90a9e129918938608e71a8fc410dc
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.facebook.react</groupId>
<artifactId>react-native</artifactId>
<version>0.61.5</version>
<packaging>aar</packaging>
<name>ReactNative</name>
<description>A framework for building native apps with React</description>
<url>https://github.com/facebook/react-native</url>
<licenses>
<license>
<name>MIT License</name>
<url>https://github.com/facebook/react-native/blob/master/LICENSE</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<id>facebook</id>
<name>Facebook</name>
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/facebook/react-native.git</connection>
<developerConnection>scm:git:git@github.com:facebook/react-native.git</developerConnection>
<url>https://github.com/facebook/react-native.git</url>
</scm>
<dependencies>
<dependency>
<groupId>com.facebook.infer.annotation</groupId>
<artifactId>infer-annotation</artifactId>
<version>0.11.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>androidx.appcompat</groupId>
<artifactId>appcompat</artifactId>
<version>1.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.facebook.fresco</groupId>
<artifactId>fresco</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.facebook.fresco</groupId>
<artifactId>imagepipeline-okhttp3</artifactId>
<version>2.0.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.facebook.soloader</groupId>
<artifactId>soloader</artifactId>
<version>0.6.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>3.12.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-urlconnection</artifactId>
<version>3.12.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>1.15.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
@@ -0,0 +1 @@
d773081803ace0462fc69253c3c251b3
@@ -0,0 +1 @@
42dccae2647b050b57e05e41e2bec898927aeb37
12 changes: 12 additions & 0 deletions android/com/facebook/react/react-native/maven-metadata.xml
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.facebook.react</groupId>
<artifactId>react-native</artifactId>
<versioning>
<release>0.61.5</release>
<versions>
<version>0.61.5</version>
</versions>
<lastUpdated>20200825033515</lastUpdated>
</versioning>
</metadata>
@@ -0,0 +1 @@
3d3d0448d2f1762dbcf7929b9dec7d3f
@@ -0,0 +1 @@
38548fd90151fdc1c02c319d19a719249b3786e0
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 155a4f7

Please sign in to comment.