jest-expo 45.0.0 → 46.0.1

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.
@@ -37,22 +37,14 @@ function getPlatformPreset(displayOptions, extensions) {
37
37
  // Combine React Native for web with React Native
38
38
  // Use RNWeb for the testEnvironment
39
39
  function getBaseWebPreset() {
40
- let reactNativePreset;
41
- try {
42
- reactNativePreset = require('react-native-web/jest-preset');
43
- } catch (error) {
44
- console.error(error);
45
- throw error;
46
- }
47
40
  return {
48
41
  ...expoPreset,
49
- ...reactNativePreset,
50
- setupFiles: reactNativePreset.setupFiles,
42
+ setupFiles: [require.resolve('../src/preset/setup-web.js')],
51
43
  moduleNameMapper: {
52
44
  ...expoPreset.moduleNameMapper,
53
45
  // Add react-native-web alias
54
46
  // This makes the tests take ~2x longer
55
- ...reactNativePreset.moduleNameMapper,
47
+ '^react-native$': 'react-native-web',
56
48
  },
57
49
  };
58
50
  }
@@ -62,6 +54,7 @@ module.exports = {
62
54
  return {
63
55
  ...getBaseWebPreset(),
64
56
  ...getPlatformPreset({ name: 'Web', color: 'magenta' }, ['web']),
57
+ testEnvironment: 'jsdom',
65
58
  };
66
59
  },
67
60
  getNodePreset() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-expo",
3
- "version": "45.0.0",
3
+ "version": "46.0.1",
4
4
  "description": "A Jest preset to painlessly test your Expo / React Native apps.",
5
5
  "license": "MIT",
6
6
  "main": "src",
@@ -31,19 +31,19 @@
31
31
  "preset": "jest-expo/universal"
32
32
  },
33
33
  "dependencies": {
34
- "@expo/config": "^6.0.14",
35
- "@jest/create-cache-key-function": "^26.6.2",
34
+ "@expo/config": "~7.0.0",
35
+ "@jest/create-cache-key-function": "^27.0.1",
36
36
  "babel-jest": "^26.6.3",
37
37
  "find-up": "^5.0.0",
38
38
  "jest-watch-select-projects": "^2.0.0",
39
39
  "jest-watch-typeahead": "0.6.4",
40
40
  "json5": "^2.1.0",
41
41
  "lodash": "^4.17.19",
42
- "react-test-renderer": "~17.0.2"
42
+ "react-test-renderer": "~18.0.0"
43
43
  },
44
44
  "bugs": {
45
45
  "url": "https://github.com/expo/expo/issues"
46
46
  },
47
47
  "homepage": "https://github.com/expo/expo/tree/main/packages/jest-expo",
48
- "gitHead": "3142a9219df26221daddd41a0a8295f9a76603aa"
48
+ "gitHead": "8151bf48e683a50e942ef213f7978b35c41f5e11"
49
49
  }
package/src/index.js CHANGED
@@ -70,6 +70,7 @@ export function mockLinking() {
70
70
  const subscription = emitter.addListener(type, cb);
71
71
  subscriptions[type] = subscriptions[type] || new Map();
72
72
  subscriptions[type].set(cb, subscription);
73
+ return subscription;
73
74
  })
74
75
  );
75
76
 
@@ -1,6 +1,6 @@
1
1
  const createCacheKeyFunction = require('@jest/create-cache-key-function').default;
2
2
 
3
3
  module.exports = {
4
- process: (_, filename) => `module.exports = 1;`,
4
+ process: (_, filename) => ({ code: `module.exports = 1;` }),
5
5
  getCacheKey: createCacheKeyFunction([__filename]),
6
6
  };