Compare commits

...
Author SHA1 Message Date
Rob HoganandFacebook GitHub Bot c8032ef1b6 Update monorepo Jest to 29.7.0
Summary:
Update the version of Jest used in React Native and Metro's own tests from `^29.6.3` to `^29.7.0`

Changelog: [Internal]

Differential Revision: D69307514
2025-02-07 07:09:34 -08:00
Rob HoganandFacebook GitHub Bot 331f543036 Fantom: Use hierarchical resolution within node_modules in Metro config
Summary:
Fantom was disabling Metro hierarchical lookup in all cases when `JS_DIR` is set. The intention is that `node_modules` folders other than the configured `JS_DIR/public/node_modules` are not used.

However, this leads to incorrect resolution where a transitive dependency is not hoisted. If the origin of the resolution is already inside `node_modules`, we must perform a hierarchical lookup to avoid picking up just whichever version happens to be hoisted to `node_modules` root.

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D69303559
2025-02-07 07:09:34 -08:00
6 changed files with 22 additions and 12 deletions
+2 -2
View File
@@ -49,7 +49,7 @@
"@babel/preset-env": "^7.25.3",
"@babel/preset-flow": "^7.24.7",
"@definitelytyped/dtslint": "^0.0.127",
"@jest/create-cache-key-function": "^29.6.3",
"@jest/create-cache-key-function": "^29.7.0",
"@react-native/metro-babel-transformer": "0.79.0-main",
"@react-native/metro-config": "0.79.0-main",
"@tsconfig/node18": "1.0.1",
@@ -84,7 +84,7 @@
"hermes-eslint": "0.25.1",
"hermes-transform": "0.25.1",
"inquirer": "^7.1.0",
"jest": "^29.6.3",
"jest": "^29.7.0",
"jest-diff": "^29.7.0",
"jest-junit": "^10.0.0",
"jest-snapshot": "^29.7.0",
+1 -1
View File
@@ -26,7 +26,7 @@
"chalk": "^4.1.2",
"commander": "^12.0.0",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"jest": "^29.7.0",
"listr2": "^8.2.1",
"react-test-renderer": "19.0.0",
"rxjs": "^7.8.1"
@@ -33,7 +33,7 @@
"@babel/plugin-transform-flow-strip-types": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@types/jest": "^29.5.3",
"jest": "^29.6.3",
"jest": "^29.7.0",
"rimraf": "^3.0.2"
},
"peerDependencies": {
@@ -20,6 +20,7 @@ const rnTesterConfig = getDefaultConfig(
const JS_DIR = process.env.JS_DIR
? path.resolve(process.cwd(), process.env.JS_DIR)
: null;
const NODE_MODULES = path.sep + 'node_modules' + path.sep;
const config = {
projectRoot: path.resolve(__dirname, '../../..'),
@@ -28,12 +29,22 @@ const config = {
},
resolver: {
blockList: /\/RendererProxy\.fb\.js$/, // Disable dependency injection for the renderer
disableHierarchicalLookup: !!JS_DIR,
sourceExts: ['fb.js', ...rnTesterConfig.resolver.sourceExts],
nodeModulesPaths: JS_DIR
? [path.join(JS_DIR, 'public', 'node_modules')]
: [],
hasteImplModulePath: path.resolve(__dirname, 'hasteImpl.js'),
resolveRequest: JS_DIR
? (ctx, dep, platform) =>
ctx.originModulePath.includes(NODE_MODULES)
? ctx.resolveRequest(ctx, dep, platform)
: // Disable hierarchical node_modules lookup from 1P code.
ctx.resolveRequest(
{...ctx, disableHierarchicalLookup: true},
dep,
platform,
)
: null,
},
transformer: {
// We need to wrap the default transformer so we can run it from source
@@ -43,8 +54,7 @@ const config = {
watchFolders: JS_DIR
? [
path.join(JS_DIR, 'RKJSModules', 'vendor', 'react'),
path.join(JS_DIR, 'tools', 'metro'),
path.join(JS_DIR, 'node_modules'),
path.join(JS_DIR, 'tools', 'metro', 'packages', 'metro-runtime'),
path.join(JS_DIR, 'public', 'node_modules'),
]
: [],
+2 -2
View File
@@ -107,7 +107,7 @@
}
},
"dependencies": {
"@jest/create-cache-key-function": "^29.6.3",
"@jest/create-cache-key-function": "^29.7.0",
"@react-native/assets-registry": "0.79.0-main",
"@react-native/codegen": "0.79.0-main",
"@react-native/community-cli-plugin": "0.79.0-main",
@@ -127,7 +127,7 @@
"flow-enums-runtime": "^0.0.6",
"glob": "^7.1.1",
"invariant": "^2.2.4",
"jest-environment-node": "^29.6.3",
"jest-environment-node": "^29.7.0",
"memoize-one": "^5.0.0",
"metro-runtime": "^0.81.0",
"metro-source-map": "^0.81.0",
+3 -3
View File
@@ -1360,7 +1360,7 @@
slash "^3.0.0"
strip-ansi "^6.0.0"
"@jest/create-cache-key-function@^29.6.3":
"@jest/create-cache-key-function@^29.7.0":
version "29.7.0"
resolved "https://registry.yarnpkg.com/@jest/create-cache-key-function/-/create-cache-key-function-29.7.0.tgz#793be38148fab78e65f40ae30c36785f4ad859f0"
integrity sha512-4QqS3LY5PBmTRHj9sAg1HLoPzqAI0uOX6wI/TRqHIcOxlFidy6YEmCQJk6FSZjNLGCeubDMfmkWL+qaLKhSGQA==
@@ -5531,7 +5531,7 @@ jest-each@^29.7.0:
jest-util "^29.7.0"
pretty-format "^29.7.0"
jest-environment-node@^29.6.3, jest-environment-node@^29.7.0:
jest-environment-node@^29.7.0:
version "29.7.0"
resolved "https://registry.yarnpkg.com/jest-environment-node/-/jest-environment-node-29.7.0.tgz#0b93e111dda8ec120bc8300e6d1fb9576e164376"
integrity sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==
@@ -5799,7 +5799,7 @@ jest-worker@^29.6.3, jest-worker@^29.7.0:
merge-stream "^2.0.0"
supports-color "^8.0.0"
jest@^29.6.3:
jest@^29.7.0:
version "29.7.0"
resolved "https://registry.yarnpkg.com/jest/-/jest-29.7.0.tgz#994676fc24177f088f1c5e3737f5697204ff2613"
integrity sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==