diff --git a/jest.config.js b/jest.config.js index f93c90dabb5881..c9656016595632 100644 --- a/jest.config.js +++ b/jest.config.js @@ -41,6 +41,9 @@ module.exports = { platforms: ['ios', 'android'], }, moduleNameMapper: { + // These mappers allow out-of-tree platforms tests to seamlessly resolve RN imports + '^react-native/(.*)': '/packages/react-native/$1', + '^react-native$': '/packages/react-native/index.js', // This module is internal to Meta and used by their custom React renderer. // In tests, we can just use a mock. '^ReactNativeInternalFeatureFlags$': diff --git a/packages/react-native/types/tsconfig.json b/packages/react-native/types/tsconfig.json index 7cabbef31792d9..8f693581db76f3 100644 --- a/packages/react-native/types/tsconfig.json +++ b/packages/react-native/types/tsconfig.json @@ -1,15 +1,18 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": ["es6"], - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "types": [], - "jsx": "react", - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "paths": {"react-native": ["."]} + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "types": [], + "jsx": "react", + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "react-native": ["."], + "react-native/*": ["../*"] } } +}