jest-expo 45.0.0-beta.2 → 46.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ 'use strict';
2
+
3
+ global.__DEV__ = true;
4
+
5
+ // Workaround undefined ShadowRoot in react-native-web
6
+ global.ShadowRoot = function () {};
@@ -6,7 +6,6 @@
6
6
 
7
7
  const mockNativeModules = require('react-native/Libraries/BatchedBridge/NativeModules');
8
8
 
9
- const createMockConstants = require('./createMockConstants');
10
9
  const publicExpoModules = require('./expoModules');
11
10
  const internalExpoModules = require('./internalExpoModules');
12
11
 
@@ -106,15 +105,6 @@ Object.keys(mockNativeModules.NativeUnimoduleProxy.viewManagersMetadata).forEach
106
105
  }
107
106
  );
108
107
 
109
- const modulesConstants = mockNativeModules.NativeUnimoduleProxy.modulesConstants;
110
- mockNativeModules.NativeUnimoduleProxy.modulesConstants = {
111
- ...modulesConstants,
112
- ExponentConstants: {
113
- ...modulesConstants.ExponentConstants,
114
- ...createMockConstants(),
115
- },
116
- };
117
-
118
108
  try {
119
109
  jest.mock('expo-file-system', () => ({
120
110
  downloadAsync: jest.fn(() => Promise.resolve({ md5: 'md5', uri: 'uri' })),
@@ -1,51 +0,0 @@
1
- 'use strict';
2
-
3
- const { getConfig } = require('@expo/config');
4
- const assert = require('assert');
5
- const findUp = require('find-up');
6
- const path = require('path');
7
-
8
- function findUpPackageJson(root) {
9
- const packageJson = findUp.sync('package.json', { cwd: root });
10
- assert(packageJson, `No package.json found for module "${root}"`);
11
- return packageJson;
12
- }
13
-
14
- /**
15
- * Returns an object with mock exports for the Constants module, such as the
16
- * manifest.
17
- */
18
- module.exports = function createMockConstants() {
19
- const expoConfig = readExpoConfig();
20
-
21
- const mockDeveloper = '@test';
22
- const mockSlug = expoConfig.slug || 'test';
23
- const mockId = `${mockDeveloper}/${mockSlug}`;
24
- const mockLinkingUri = `exp://exp.host/${mockDeveloper}/${mockSlug}/--/`;
25
- const mockHostUri = `exp.host/${mockDeveloper}/${mockSlug}`;
26
- const mockSdkVersion = expoConfig.sdkVersion || '42.0.0';
27
-
28
- return {
29
- deviceName: 'Test Phone',
30
- installationId: 'a01650bb-918d-40be-87be-cf376ab6189f',
31
- linkingUri: mockLinkingUri,
32
- manifest: {
33
- id: mockId,
34
- originalFullName: '@test/originaltest',
35
- currentFullName: mockId,
36
- slug: mockSlug,
37
- extra: expoConfig.extra,
38
- hostUri: mockHostUri,
39
- sdkVersion: mockSdkVersion,
40
- scheme: expoConfig.scheme,
41
- },
42
- };
43
- };
44
-
45
- function readExpoConfig() {
46
- // This file is under <package>/node_modules/jest-expo/src and we want to
47
- // start looking for app.json under <package>
48
- const nextDirectory = path.resolve(__dirname, '..', '..', '..');
49
- const projectRoot = path.dirname(findUpPackageJson(nextDirectory));
50
- return getConfig(projectRoot, { skipSDKVersionRequirement: true }).exp;
51
- }