Skip to content

Commit 98f9c97

Browse files
committed
Make JS and TS tests independent of react-native package name
1 parent 3acd797 commit 98f9c97

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ module.exports = {
4141
platforms: ['ios', 'android'],
4242
},
4343
moduleNameMapper: {
44+
// These mappers allow out-of-tree platforms tests to seamlessly resolve RN imports
45+
'^react-native/(.*)': '<rootDir>/packages/react-native/$1',
46+
'^react-native$': '<rootDir>/packages/react-native/index.js',
4447
// This module is internal to Meta and used by their custom React renderer.
4548
// In tests, we can just use a mock.
4649
'^ReactNativeInternalFeatureFlags$':
Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
{
2-
"compilerOptions": {
3-
"module": "commonjs",
4-
"lib": ["es6"],
5-
"noImplicitAny": true,
6-
"noImplicitThis": true,
7-
"strictFunctionTypes": true,
8-
"strictNullChecks": true,
9-
"types": [],
10-
"jsx": "react",
11-
"noEmit": true,
12-
"forceConsistentCasingInFileNames": true,
13-
"paths": {"react-native": ["."]}
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"lib": ["es6"],
5+
"noImplicitAny": true,
6+
"noImplicitThis": true,
7+
"strictFunctionTypes": true,
8+
"strictNullChecks": true,
9+
"types": [],
10+
"jsx": "react",
11+
"noEmit": true,
12+
"forceConsistentCasingInFileNames": true,
13+
"paths": {
14+
"react-native": ["."],
15+
"react-native/*": ["../*"]
1416
}
1517
}
18+
}

0 commit comments

Comments
 (0)