jest-expo 45.0.1 → 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.
- package/config/getPlatformPreset.js +3 -10
- package/package.json +4 -4
- package/src/index.js +1 -0
- package/src/preset/assetFileTransformer.js +1 -1
- package/src/preset/expoModules.js +442 -714
- package/src/preset/setup-web.js +6 -0
- package/src/preset/setup.js +0 -10
- package/src/preset/createMockConstants.js +0 -51
|
@@ -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
|
-
|
|
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
|
-
|
|
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": "
|
|
3
|
+
"version": "46.0.0",
|
|
4
4
|
"description": "A Jest preset to painlessly test your Expo / React Native apps.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "src",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"preset": "jest-expo/universal"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@expo/config": "
|
|
34
|
+
"@expo/config": "~6.0.24",
|
|
35
35
|
"@jest/create-cache-key-function": "^27.0.1",
|
|
36
36
|
"babel-jest": "^26.6.3",
|
|
37
37
|
"find-up": "^5.0.0",
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"jest-watch-typeahead": "0.6.4",
|
|
40
40
|
"json5": "^2.1.0",
|
|
41
41
|
"lodash": "^4.17.19",
|
|
42
|
-
"react-test-renderer": "~
|
|
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": "
|
|
48
|
+
"gitHead": "6e131f2da851a47c3a24eb3d6fc971a1a7822086"
|
|
49
49
|
}
|
package/src/index.js
CHANGED
|
@@ -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
|
};
|