mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 11:34:23 +00:00
e315ec9891
Summary:
We opt in to version ^5 of the React Native Babel Preset, as required after the bump to Babel 7. This fixes the Objective-C end-to-end test failure in master. (Fixes #19538)
See 34bd776af2 (commitcomment-29024085)
for prior discussion.
There have already been several changes made to the repo during the transition to Babel 7. This PR brings all tests back to green and allows us to move forward with the 0.56 branch cut.
We also bump our tests to use Xcode 9.4.0 and iOS 11.4, the latest stable versions of both.
Once the 0.56 branch makes it to stable, we can change `react-native-babel-preset@latest` on npm to point to `react-native-babel-preset@5.0.1` (or newer), and undo the change made to `init.js` we made as part of this diff.
Wait for Circle CI to run: https://circleci.com/workflow-run/e39a66d7-bf8a-4b31-a22f-eef30a2c53bc
[GENERAL] [BREAKING] [Babel] - Bump React Native Babel Preset version used by RN CLI to Babel v7 compliant release
Closes https://github.com/facebook/react-native/pull/19625
Reviewed By: TheSavior
Differential Revision: D8343861
Pulled By: hramos
fbshipit-source-id: 42644d5b0bfb40a8bc592ae3461c5008deef8232
94 lines
2.8 KiB
Bash
Executable File
94 lines
2.8 KiB
Bash
Executable File
#!/bin/bash
|
|
set -ex
|
|
|
|
# Script used to run iOS and tvOS tests.
|
|
# Environment variables are used to configure what test to run.
|
|
# If not arguments are passed to the script, it will only compile
|
|
# the RNTester.
|
|
# If the script is called with a single argument "test", we'll
|
|
# also run the RNTester integration test (needs JS and packager).
|
|
# ./objc-test.sh test
|
|
|
|
SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
ROOT=$(dirname $SCRIPTS)
|
|
|
|
cd $ROOT
|
|
|
|
# Create cleanup handler
|
|
function cleanup {
|
|
EXIT_CODE=$?
|
|
set +e
|
|
|
|
if [ $EXIT_CODE -ne 0 ];
|
|
then
|
|
WATCHMAN_LOGS=/usr/local/Cellar/watchman/3.1/var/run/watchman/$USER.log
|
|
[ -f $WATCHMAN_LOGS ] && cat $WATCHMAN_LOGS
|
|
fi
|
|
# kill whatever is occupying port 8081 (packager)
|
|
lsof -i tcp:8081 | awk 'NR!=1 {print $2}' | xargs kill
|
|
# kill whatever is occupying port 5555 (web socket server)
|
|
lsof -i tcp:5555 | awk 'NR!=1 {print $2}' | xargs kill
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
# Wait for the package to start
|
|
function waitForPackager {
|
|
local -i max_attempts=60
|
|
local -i attempt_num=1
|
|
|
|
until $(curl -s http://localhost:8081/status | grep "packager-status:running" -q); do
|
|
if (( attempt_num == max_attempts )); then
|
|
echo "Packager did not respond in time. No more attempts left."
|
|
exit 1
|
|
else
|
|
(( attempt_num++ ))
|
|
echo "Packager did not respond. Retrying for attempt number $attempt_num..."
|
|
sleep 1
|
|
fi
|
|
done
|
|
|
|
echo "Packager is ready!"
|
|
}
|
|
|
|
# If first argument is "test", actually start the packager and run tests.
|
|
# Otherwise, just build RNTester for tvOS and exit
|
|
|
|
if [ "$1" = "test" ]; then
|
|
|
|
# Start the packager
|
|
./scripts/packager.sh --max-workers=1 || echo "Can't start packager automatically" &
|
|
# Start the WebSocket test server
|
|
open "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically"
|
|
|
|
waitForPackager
|
|
|
|
# Preload the RNTesterApp bundle for better performance in integration tests
|
|
curl 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true' -o temp.bundle
|
|
rm temp.bundle
|
|
curl 'http://localhost:8081/RNTester/js/RNTesterApp.ios.bundle?platform=ios&dev=true&minify=false' -o temp.bundle
|
|
rm temp.bundle
|
|
curl 'http://localhost:8081/IntegrationTests/IntegrationTestsApp.bundle?platform=ios&dev=true' -o temp.bundle
|
|
rm temp.bundle
|
|
curl 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' -o temp.bundle
|
|
rm temp.bundle
|
|
|
|
# Run tests
|
|
xcodebuild \
|
|
-project "RNTester/RNTester.xcodeproj" \
|
|
-scheme $SCHEME \
|
|
-sdk $SDK \
|
|
-destination "$DESTINATION" \
|
|
build test \
|
|
| xcpretty --report junit --output "$HOME/react-native/reports/junit/$TEST_NAME/results.xml"
|
|
|
|
else
|
|
|
|
# Don't run tests. No need to pass -destination to xcodebuild.
|
|
xcodebuild \
|
|
-project "RNTester/RNTester.xcodeproj" \
|
|
-scheme $SCHEME \
|
|
-sdk $SDK \
|
|
build
|
|
|
|
fi
|