diff --git a/jest/integration/config/metro.config.js b/jest/integration/config/metro.config.js index 3c8244156a5737..bff07bde93a524 100644 --- a/jest/integration/config/metro.config.js +++ b/jest/integration/config/metro.config.js @@ -17,6 +17,10 @@ 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: { @@ -24,10 +28,10 @@ const config = { }, 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'), }, @@ -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'), ] : [], };