From 441f167d06c6f4d1bbcb9797a4478f2416242d41 Mon Sep 17 00:00:00 2001 From: Alex Hunt Date: Mon, 27 Mar 2023 11:21:56 -0700 Subject: [PATCH] Fix paths in objc-test.sh, temporarily exclude /IntegrationTests (#36648) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/36648 Changelog: [Internal] Blocker for https://github.com/facebook/react-native/pull/36623. The `test-ios` job in CI was misconfigured following the monorepo migration — and this becomes load-bearing with the incoming version of React Native CLI. - Update `objc-test.sh` to run in `packages/rn-tester`, and exclude tests under `/IntegrationTests` which are outside of a Metro project directory. - **This is temporary** — a task has been created to move/split up/otherwise restore tests in `IntegrationTests`, which cipolleschi is following up (thanks!). - Also fix `yarn start` script in `packages/rn-tester`. Reviewed By: cipolleschi Differential Revision: D44416533 fbshipit-source-id: 59c5b743d9d8fda206a12e37d94324ed9bfd703e --- .../rn-tester/RNTester/RNTester.xctestplan | 1 + packages/rn-tester/package.json | 2 +- scripts/objc-test.sh | 27 ++++++++++++------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/packages/rn-tester/RNTester/RNTester.xctestplan b/packages/rn-tester/RNTester/RNTester.xctestplan index 147173b22f8bc4..3fcd0a248433aa 100644 --- a/packages/rn-tester/RNTester/RNTester.xctestplan +++ b/packages/rn-tester/RNTester/RNTester.xctestplan @@ -28,6 +28,7 @@ }, "testTargets" : [ { + "enabled": false, "target" : { "containerPath" : "container:RNTesterPods.xcodeproj", "identifier" : "E7DB215222B2F332005AC45F", diff --git a/packages/rn-tester/package.json b/packages/rn-tester/package.json index 28ae2dad4d0648..90924e232302f9 100644 --- a/packages/rn-tester/package.json +++ b/packages/rn-tester/package.json @@ -11,7 +11,7 @@ "directory": "packages/rn-tester" }, "scripts": { - "start": "../react-native/scripts/packager.sh", + "start": "react-native start", "install-android-jsc": "../../gradlew :packages:rn-tester:android:app:installJscDebug", "install-android-hermes": "../../gradlew :packages:rn-tester:android:app:installHermesDebug", "clean-android": "rm -rf android/app/build", diff --git a/scripts/objc-test.sh b/scripts/objc-test.sh index 83ff7639de7f40..490e7ada8b233a 100755 --- a/scripts/objc-test.sh +++ b/scripts/objc-test.sh @@ -75,9 +75,9 @@ waitForWebSocketServer() { runTests() { # shellcheck disable=SC1091 - source "./scripts/.tests.env" + source "$ROOT/scripts/.tests.env" xcodebuild build test \ - -workspace packages/rn-tester/RNTesterPods.xcworkspace \ + -workspace RNTesterPods.xcworkspace \ -scheme RNTester \ -sdk iphonesimulator \ -destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \ @@ -86,7 +86,7 @@ runTests() { buildProject() { xcodebuild build \ - -workspace packages/rn-tester/RNTesterPods.xcworkspace \ + -workspace RNTesterPods.xcworkspace \ -scheme RNTester \ -sdk iphonesimulator } @@ -105,16 +105,21 @@ xcbeautifyFormat() { xcbeautify --report junit --report-path "$REPORTS_DIR/ios/results.xml" } -preloadBundles() { - # Preload the RNTesterApp bundle for better performance in integration tests - curl -s 'http://localhost:8081/packages/rn-tester/js/RNTesterApp.ios.bundle?platform=ios&dev=true' -o /dev/null - curl -s 'http://localhost:8081/packages/rn-tester/js/RNTesterApp.ios.bundle?platform=ios&dev=true&minify=false' -o /dev/null +preloadBundlesRNIntegrationTests() { + # Preload IntegrationTests bundles (/) + # TODO(T149119847): These need to be relocated into a dir with a Metro config curl -s 'http://localhost:8081/IntegrationTests/IntegrationTestsApp.bundle?platform=ios&dev=true' -o /dev/null curl -s 'http://localhost:8081/IntegrationTests/RCTRootViewIntegrationTestApp.bundle?platform=ios&dev=true' -o /dev/null } +preloadBundlesRNTester() { + # Preload RNTesterApp bundles (packages/rn-tester/) + curl -s 'http://localhost:8081/js/RNTesterApp.ios.bundle?platform=ios&dev=true' -o /dev/null + curl -s 'http://localhost:8081/js/RNTesterApp.ios.bundle?platform=ios&dev=true&minify=false' -o /dev/null +} + main() { - cd "$ROOT" || exit + cd "$ROOT/packages/rn-tester" || exit # If first argument is "test", actually start the packager and run tests. # Otherwise, just build RNTester and exit @@ -122,13 +127,15 @@ main() { # Start the WebSocket test server echo "Launch WebSocket Server" - sh "./IntegrationTests/launchWebSocketServer.sh" & + sh "$ROOT/IntegrationTests/launchWebSocketServer.sh" & waitForWebSocketServer # Start the packager yarn start --max-workers=1 || echo "Can't start packager automatically" & waitForPackager - preloadBundles + preloadBundlesRNTester + # TODO(T149119847) + # preloadBundlesRNIntegrationTests # Build and run tests. if [ -x "$(command -v xcbeautify)" ]; then