Skip to content

Commit

Permalink
Allow JS_DIR path to be relative to cwd (facebook#47877)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: facebook#47877

Changelog: [internal]

Reviewed By: sammy-SC

Differential Revision: D66302814

fbshipit-source-id: 55d6f86d098673e28fad71a43863f2041810d04b
  • Loading branch information
rubennorte authored and facebook-github-bot committed Nov 21, 2024
1 parent ae09827 commit 6c581c9
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions jest/integration/config/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,21 @@ const rnTesterConfig = getDefaultConfig(
path.resolve('../../../packages/rn-tester'),
);

const JS_DIR = process.env.JS_DIR
? path.resolve(process.cwd(), process.env.JS_DIR)
: null;

const config = {
projectRoot: path.resolve(__dirname, '../../..'),
reporter: {
update: () => {},
},
resolver: {
blockList: /\/RendererProxy\.fb\.js$/, // Disable dependency injection for the renderer
disableHierarchicalLookup: !!process.env.JS_DIR,
disableHierarchicalLookup: !!JS_DIR,
sourceExts: ['fb.js', ...rnTesterConfig.resolver.sourceExts],
nodeModulesPaths: process.env.JS_DIR
? [path.join(process.env.JS_DIR, 'public', 'node_modules')]
nodeModulesPaths: JS_DIR
? [path.join(JS_DIR, 'public', 'node_modules')]
: [],
hasteImplModulePath: path.resolve(__dirname, 'hasteImpl.js'),
},
Expand All @@ -36,12 +40,12 @@ const config = {
// using babel-register.
babelTransformerPath: path.resolve(__dirname, 'metro-babel-transformer.js'),
},
watchFolders: process.env.JS_DIR
watchFolders: JS_DIR
? [
path.join(process.env.JS_DIR, 'RKJSModules', 'vendor', 'react'),
path.join(process.env.JS_DIR, 'tools', 'metro'),
path.join(process.env.JS_DIR, 'node_modules'),
path.join(process.env.JS_DIR, 'public', 'node_modules'),
path.join(JS_DIR, 'RKJSModules', 'vendor', 'react'),
path.join(JS_DIR, 'tools', 'metro'),
path.join(JS_DIR, 'node_modules'),
path.join(JS_DIR, 'public', 'node_modules'),
]
: [],
};
Expand Down

0 comments on commit 6c581c9

Please sign in to comment.