jest-expo 56.0.0 → 56.0.2

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/jest-preset.js +22 -5
  3. package/package.json +10 -8
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015-present 650 Industries, Inc. (aka Expo)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/jest-preset.js CHANGED
@@ -2,8 +2,26 @@
2
2
 
3
3
  const cloneDeep = require('lodash/cloneDeep');
4
4
  const isEqual = require('lodash/isEqual');
5
- // Derive the Expo Jest preset from the React Native one
6
- const jestPreset = cloneDeep(require('react-native/jest-preset'));
5
+
6
+ let jestPreset;
7
+ try {
8
+ jestPreset = require('@react-native/jest-preset');
9
+ } catch (error) {
10
+ if (error.code === 'MODULE_NOT_FOUND') {
11
+ try {
12
+ // NOTE(@kitten): We can still try the old import to see if it
13
+ // works, in case there's some kind of version mismatch
14
+ jestPreset = require('react-native/jest-preset');
15
+ } catch {
16
+ throw new Error(
17
+ 'The React Native Jest preset that jest-expo relies on has moved to a separate package.\n' +
18
+ 'To migrate, please install "@react-native/jest-preset" to fulfill jest-expo\'s peer dependency.'
19
+ );
20
+ }
21
+ }
22
+ }
23
+
24
+ jestPreset = cloneDeep(jestPreset);
7
25
 
8
26
  const { withTypescriptMapping } = require('./src/preset/withTypescriptMapping');
9
27
  const { resolveBabelConfig } = require('./src/resolveBabelConfig');
@@ -81,9 +99,8 @@ const defaultExpoMetroAssetExts = [
81
99
  ];
82
100
 
83
101
  const assetNamePattern = `^.+\\.(${defaultExpoMetroAssetExts.join('|')})$`;
84
- jestPreset.transform[assetNamePattern] = require.resolve(
85
- 'jest-expo/src/preset/assetFileTransformer.js'
86
- );
102
+ jestPreset.transform[assetNamePattern] =
103
+ require.resolve('jest-expo/src/preset/assetFileTransformer.js');
87
104
 
88
105
  // transformIgnorePatterns
89
106
  if (!Array.isArray(jestPreset.transformIgnorePatterns)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-expo",
3
- "version": "56.0.0",
3
+ "version": "56.0.2",
4
4
  "description": "A Jest preset to painlessly test your Expo / React Native apps.",
5
5
  "license": "MIT",
6
6
  "main": "src/index.js",
@@ -29,10 +29,6 @@
29
29
  "bin": {
30
30
  "jest": "bin/jest.js"
31
31
  },
32
- "scripts": {
33
- "lint": "eslint .",
34
- "test": "jest"
35
- },
36
32
  "jest": {
37
33
  "preset": "jest-expo/universal"
38
34
  },
@@ -52,6 +48,7 @@
52
48
  },
53
49
  "peerDependencies": {
54
50
  "react-native": "*",
51
+ "@react-native/jest-preset": "^0.85.0",
55
52
  "react-server-dom-webpack": "~19.0.4 || ~19.1.5 || ~19.2.4"
56
53
  },
57
54
  "peerDependenciesMeta": {
@@ -61,7 +58,12 @@
61
58
  },
62
59
  "devDependencies": {
63
60
  "@types/react": "~19.2.0",
64
- "react-server-dom-webpack": "~19.0.4"
61
+ "@react-native/jest-preset": "0.85.3",
62
+ "react-server-dom-webpack": "~19.0.6"
65
63
  },
66
- "gitHead": "6dcd9ce9d615d25df78597f60520492e35e02efb"
67
- }
64
+ "gitHead": "51c27fce31a5b3a877a4b05d832dabf4a99db5e1",
65
+ "scripts": {
66
+ "lint": "eslint .",
67
+ "test": "jest"
68
+ }
69
+ }