jest-expo 54.0.8 → 54.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jest-expo",
3
- "version": "54.0.8",
3
+ "version": "54.0.10",
4
4
  "description": "A Jest preset to painlessly test your Expo / React Native apps.",
5
5
  "license": "MIT",
6
6
  "main": "src/index.js",
@@ -37,12 +37,11 @@
37
37
  "preset": "jest-expo/universal"
38
38
  },
39
39
  "dependencies": {
40
- "@expo/config": "~12.0.7",
41
- "@expo/json-file": "^10.0.6",
40
+ "@expo/config": "~12.0.8",
41
+ "@expo/json-file": "^10.0.7",
42
42
  "@jest/create-cache-key-function": "^29.2.1",
43
43
  "@jest/globals": "^29.2.1",
44
44
  "babel-jest": "^29.2.1",
45
- "find-up": "^5.0.0",
46
45
  "jest-environment-jsdom": "^29.2.1",
47
46
  "jest-snapshot": "^29.2.1",
48
47
  "jest-watch-select-projects": "^2.0.0",
@@ -58,5 +57,5 @@
58
57
  "expo": "*",
59
58
  "react-native": "*"
60
59
  },
61
- "gitHead": "8cafaff8076e443e6c80e8013ec809f4f290f24d"
60
+ "gitHead": "fa290a5f502ef415f4392b28db9498378154384f"
62
61
  }
@@ -4,7 +4,7 @@
4
4
  */
5
5
  'use strict';
6
6
 
7
- const findUp = require('find-up');
7
+ const fs = require('fs');
8
8
  const merge = require('lodash/merge');
9
9
  const path = require('path');
10
10
  const mockNativeModules = require('react-native/Libraries/BatchedBridge/NativeModules').default;
@@ -196,9 +196,17 @@ function attemptLookup(moduleName) {
196
196
  if (!filePath) {
197
197
  return null;
198
198
  }
199
- const modulePath = findUp.sync('package.json', { cwd: filePath.fileName });
200
- const moduleMockPath = path.join(modulePath, '..', 'mocks', moduleName);
201
199
 
200
+ let modulePath = null;
201
+ for (let dir = filePath.fileName; path.dirname(dir) !== dir; dir = path.dirname(dir)) {
202
+ const file = path.resolve(dir, 'package.json');
203
+ if (fs.existsSync(file)) {
204
+ modulePath = file;
205
+ break;
206
+ }
207
+ }
208
+
209
+ const moduleMockPath = path.join(modulePath, '..', 'mocks', moduleName);
202
210
  try {
203
211
  const mockedPackageNativeModule = jest.requireActual(moduleMockPath);
204
212
  return mockedPackageNativeModule;