Repository: parse-community/Parse-SDK-JS
Pull request #1381 (2021-07-06 07:14:10)

Fix react native build
Improve https://github.com/parse-community/Parse-SDK-JS/pull/1351

codecov[bot]: # [Codecov](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1381?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community) Report
> Merging [#1381](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1381?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community) (acf7e49) into [master](https://codecov.io/gh/parse-community/Parse-SDK-JS/commit/0bd120e92a25b542a759c1a3192105a0d4db2612?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community) (0bd120e) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

[![Impacted file tree graph](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1381/graphs/tree.svg?width=650&height=150&src=pr&token=8nCENM0QHj&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community)](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1381?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community)

```diff
@@           Coverage Diff           @@
##           master    #1381   +/-   ##
=======================================
  Coverage   99.10%   99.10%           
=======================================
  Files          61       61           
  Lines        5941     5943    +2     
  Branches     1349     1350    +1     
=======================================
+ Hits         5888     5890    +2     
  Misses         52       52           
  Partials        1        1           
```


| [Impacted Files](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1381?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community) | Coverage Δ | |
|---|---|---|
| [src/EventEmitter.js](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1381/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community#diff-c3JjL0V2ZW50RW1pdHRlci5qcw==) | `100.00% <100.00%> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1381?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1381?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community). Last update [0bd120e...acf7e49](https://codecov.io/gh/parse-community/Parse-SDK-JS/pull/1381?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=parse-community).


Patch:
diff --git a/package-lock.json b/package-lock.json
index 969cb0d..6bf8589 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1239,17 +1239,17 @@
       }
     },
     "@babel/runtime": {
-      "version": "7.14.5",
-      "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.5.tgz",
-      "integrity": "sha512-121rumjddw9c3NCQ55KGkyE1h/nzWhU/owjhw0l4mQrkzz4x9SGS1X8gFLraHwX7td3Yo4QTL+qj0NcIzN87BA==",
+      "version": "7.14.6",
+      "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.14.6.tgz",
+      "integrity": "sha512-/PCB2uJ7oM44tz8YhC4Z/6PeOKXp4K588f+5M3clr1M4zbqztlo0XEfJ2LEzj/FgwfgGcIdl8n7YYjTCI0BYwg==",
       "requires": {
         "regenerator-runtime": "^0.13.4"
       }
     },
     "@babel/runtime-corejs3": {
-      "version": "7.14.5",
-      "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.14.5.tgz",
-      "integrity": "sha512-cBbwXj3F2xjnQJ0ERaFRLjxhUSBYsQPXJ7CERz/ecx6q6hzQ99eTflAPFC3ks4q/IG4CWupNVdflc4jlFBJVsg==",
+      "version": "7.14.6",
+      "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.14.6.tgz",
+      "integrity": "sha512-Xl8SPYtdjcMoCsIM4teyVRg7jIcgl8F2kRtoCcXuHzXswt9UxZCS6BzRo8fcnCuP6u2XtPgvyonmEPF57Kxo9Q==",
       "requires": {
         "core-js-pure": "^3.14.0",
         "regenerator-runtime": "^0.13.4"
diff --git a/package.json b/package.json
index 35d4897..3252b60 100644
--- a/package.json
+++ b/package.json
@@ -29,8 +29,8 @@
     "react-native": false
   },
   "dependencies": {
-    "@babel/runtime": "7.14.5",
-    "@babel/runtime-corejs3": "7.14.5",
+    "@babel/runtime": "7.14.6",
+    "@babel/runtime-corejs3": "7.14.6",
     "idb-keyval": "5.0.6",
     "react-native-crypto-js": "1.0.0",
     "uuid": "3.4.0",
diff --git a/src/EventEmitter.js b/src/EventEmitter.js
index d45ec6b..68d8279 100644
--- a/src/EventEmitter.js
+++ b/src/EventEmitter.js
@@ -10,7 +10,10 @@
  */
 
 if (process.env.PARSE_BUILD === 'react-native') {
-  const EventEmitter = require('../../../react-native/Libraries/vendor/emitter/_EventEmitter');
+  let EventEmitter = require('../../../react-native/Libraries/vendor/emitter/EventEmitter');
+  if (EventEmitter.default) {
+    EventEmitter = EventEmitter.default;
+  }
   EventEmitter.prototype.on = EventEmitter.prototype.addListener;
   module.exports = EventEmitter;
 } else {


Test patch:
diff --git a/src/__tests__/react-native-test.js b/src/__tests__/react-native-test.js
index 802bc92..c8d2691 100644
--- a/src/__tests__/react-native-test.js
+++ b/src/__tests__/react-native-test.js
@@ -10,18 +10,21 @@ jest.dontMock('../ParseObject');
 jest.dontMock('../Storage');
 
 jest.mock(
-  '../../../../react-native/Libraries/vendor/emitter/_EventEmitter',
+  '../../../../react-native/Libraries/vendor/emitter/EventEmitter',
   () => {
     return {
-      prototype: {
-        addListener: new (require('events').EventEmitter)(),
+      default: {
+        prototype: {
+          addListener: new (require('events').EventEmitter)(),
+        },
       },
     };
   },
   { virtual: true }
 );
 
-const mockEmitter = require('../../../../react-native/Libraries/vendor/emitter/_EventEmitter');
+const mockEmitter = require('../../../../react-native/Libraries/vendor/emitter/EventEmitter')
+  .default;
 const CoreManager = require('../CoreManager');
 
 describe('React Native', () => {