Skip to content

Commit e1f493e

Browse files
Martin Konicekfacebook-github-bot
authored andcommitted
Add a flag to support a simplified iOS test - just compile, don't run packager and tests
Reviewed By: gfosco Differential Revision: D4690887 fbshipit-source-id: e6299c9146e1ac97a0606f538e9d10539f147a67
1 parent 3637bce commit e1f493e

File tree

4 files changed

+21
-5
lines changed

4 files changed

+21
-5
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ install:
1717
- $yarn install
1818

1919
script:
20-
- if [[ "$TEST_TYPE" = objc-ios ]]; then travis_retry travis_wait ./scripts/objc-test-ios.sh; fi
20+
- if [[ "$TEST_TYPE" = objc-ios ]]; then travis_retry travis_wait ./scripts/objc-test-ios.sh test; fi
2121
- if [[ "$TEST_TYPE" = objc-tvos ]]; then travis_retry travis_wait ./scripts/objc-test-tvos.sh; fi
2222
- if [[ "$TEST_TYPE" = e2e-objc ]]; then node ./scripts/run-ci-e2e-tests.js --ios --js --retries 3; fi
2323
- if [[ ( "$TEST_TYPE" = podspecs ) && ( "$TRAVIS_PULL_REQUEST" = "false" ) ]]; then gem install cocoapods && ./scripts/process-podspecs.sh; fi

docs/Testing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ See the following for example usage and integration points:
9797
You can run integration tests locally with cmd+U in the IntegrationTest and UIExplorer apps in Xcode, or by running the following in the command line on macOS:
9898

9999
$ cd react-native
100-
$ ./scripts/objc-test-ios.sh
100+
$ ./scripts/objc-test-ios.sh test
101101

102102
> Your Xcode install will come with a variety of Simulators running the latest OS. You may need to manually create a new Simulator to match what the `XCODE_DESTINATION` param in the test script.
103103

scripts/objc-test-ios.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ function cleanup {
2626
}
2727
trap cleanup INT TERM EXIT
2828

29+
# If first argument is "test", actually start the packager and run tests.
30+
# Otherwise, just build UIExplorer for tvOS and exit
31+
32+
if [ "$1" = "test" ];
33+
then
34+
2935
# Start the packager
3036
(exec "./packager/launchPackager.command" || echo "Can't start packager automatically") &
3137
(exec "./IntegrationTests/launchWebSocketServer.command" || echo "Can't start web socket server automatically") &
@@ -60,6 +66,7 @@ rm temp.bundle
6066
curl 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' -o temp.bundle
6167
rm temp.bundle
6268

69+
# Build and test for iOS
6370
# TODO: We use xcodebuild because xctool would stall when collecting info about
6471
# the tests before running them. Switch back when this issue with xctool has
6572
# been resolved.
@@ -70,3 +77,13 @@ xcodebuild \
7077
-destination "platform=iOS Simulator,name=iPhone 5s,OS=10.1" \
7178
build test
7279

80+
else
81+
82+
# Only build for iOS (check there are no missing files in the Xcode project)
83+
xcodebuild \
84+
-project "Examples/UIExplorer/UIExplorer.xcodeproj" \
85+
-scheme "UIExplorer" \
86+
-sdk "iphonesimulator" \
87+
build
88+
89+
fi

scripts/objc-test-tvos.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ function cleanup {
2323
}
2424
trap cleanup EXIT
2525

26-
# If first argument is "test", actually start the packager and run tests as in the iOS script
26+
# If first argument is "test", actually start the packager and run tests.
2727
# Otherwise, just build UIExplorer for tvOS and exit
2828

2929
if [ "$1" = "test" ];
@@ -57,12 +57,11 @@ xcodebuild \
5757

5858
else
5959

60-
# Build only (no test) for tvOS, to make sure there are no missing files
60+
# Only build for tvOS (check there are no missing files in the Xcode project)
6161
xcodebuild \
6262
-project "Examples/UIExplorer/UIExplorer.xcodeproj" \
6363
-scheme "UIExplorer-tvOS" \
6464
-sdk "appletvsimulator" \
65-
-destination "platform=tvOS Simulator,name=Apple TV 1080p,OS=10.1" \
6665
build
6766

6867
fi

0 commit comments

Comments
 (0)