Fix Detox tests after upgrading to latest CLI (#23191)

Summary:
Latest changes inside CLI now require that Metro configuration is provided when building RNTester app. This is to let CLI know that instead of looking for "react-native" under "node_modules" (that is obviously not present since we are running from source), it should check the paths provided.

When running "npm start", it finds the configuration at the root. However, when building through Xcode (e.g. "react-native bundle" or "xcodebuild" in Release scheme), it runs "react-native-xcode.sh" that works in different folder and makes Metro not detect the configuration file.

This PR explicitly sets path to the configuration via `BUNDLE_CONFIG`.

It also removes `pwd` from being prepended to all `BUNDLE_CONFIG` values. In my case, `pwd` was `/Users/grabbou` and the RNTester files where inside `/Users/grabbou/Repositories/react-native`. I was unable to point the script to correct location without making it aware of the folder structure - which is not going to work on the CI.
Pull Request resolved: https://github.com/facebook/react-native/pull/23191

Differential Revision: D13851741

Pulled By: hramos

fbshipit-source-id: d920353fd68d39468bd33bd1ad47e03b017a7727
This commit is contained in:
Mike Grabowski 2019-01-28 20:09:55 -08:00 committed by Facebook Github Bot
parent 0bf6a8e914
commit 9a9370481f
2 changed files with 3 additions and 1 deletions

View File

@ -1880,6 +1880,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
BUNDLE_CONFIG = "$(SRCROOT)/../rn-cli.config.js";
DEVELOPMENT_TEAM = VYK7DLU38Z;
INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
@ -1895,6 +1896,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
BUNDLE_CONFIG = "$(SRCROOT)/../rn-cli.config.js";
DEVELOPMENT_TEAM = VYK7DLU38Z;
INFOPLIST_FILE = "$(SRCROOT)/RNTester/Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 9.0;

View File

@ -99,7 +99,7 @@ fi
if [[ -z "$BUNDLE_CONFIG" ]]; then
CONFIG_ARG=""
else
CONFIG_ARG="--config $(pwd)/$BUNDLE_CONFIG"
CONFIG_ARG="--config $BUNDLE_CONFIG"
fi
nodejs_not_found()