fix(test): fix RNTester iOS unit and integration tests (#53848)

Summary:
This PR fixes problems with unit & integration tests in the iOS RNTester project, related to: compilation errors, JS problems, missing mocks & outdated baselines.

## Changelog:

[Internal] - Re-enabled iOS unit & integration tests, Ruby tests on CI, stripped obsolete build part before running tests, renamed uploaded xcresult artifacts

Pull Request resolved: https://github.com/facebook/react-native/pull/53848

Test Plan:
1. iOS tests pass:

- When run from dedicated xcschemes:

<img width="596" height="388" alt="image" src="https://github.com/user-attachments/assets/9f3a038b-f12e-4b12-ab95-93d55eb60d63" />

<img width="611" height="381" alt="image" src="https://github.com/user-attachments/assets/27ff3a6f-57da-4842-a96c-db569e417dc3" />

- When run from the RNTester scheme (command + U):

<img width="754" height="384" alt="image" src="https://github.com/user-attachments/assets/0b4a6e70-56da-40c1-b019-b1e87d8df591" />

2. Ruby scripting tests pass:

<img width="655" height="349" alt="image" src="https://github.com/user-attachments/assets/a6a41d16-2744-44c9-bf87-e4a06f228cfb" />

3. CI - green
4. xcresult artifacts are uploaded
<img width="1370" height="478" alt="image" src="https://github.com/user-attachments/assets/1bd0638d-f215-48f7-b798-fadb8799c5f7" />

Reviewed By: huntie

Differential Revision: D88733170

Pulled By: cipolleschi

fbshipit-source-id: e14c69bede1db34461926726bc796804b365a7a9
This commit is contained in:
artus9033
2025-12-10 08:47:16 -08:00
committed by meta-codesync[bot]
parent 700d320a5f
commit 2ce368604a
40 changed files with 360 additions and 297 deletions
+2 -2
View File
@@ -24,8 +24,8 @@ export AVD_ABI=x86
export ANDROID_DISABLE_AVD_TESTS=1
## IOS ##
export IOS_TARGET_OS="16.4"
export IOS_DEVICE="iPhone 14"
export IOS_TARGET_OS="18.3.1"
export IOS_DEVICE="iPhone 16"
export SDK_IOS="iphonesimulator"
## CI OVERRIDES ##
+7 -16
View File
@@ -15,9 +15,6 @@ SCRIPTS=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
ROOT=$(dirname "$SCRIPTS")
SKIPPED_TESTS=()
# TODO: T60408036 This test crashes iOS 13 for bad access, please investigate
# and re-enable. See https://gist.github.com/0xced/56035d2f57254cf518b5.
SKIPPED_TESTS+=("-skip-testing:RNTesterUnitTests/RCTJSONTests/testNotUTF8Convertible")
# Create cleanup handler
cleanup() {
@@ -75,33 +72,27 @@ waitForWebSocketServer() {
runTests() {
# shellcheck disable=SC1091
source "$ROOT/scripts/.tests.env"
xcodebuild build test \
xcodebuild test \
-workspace RNTesterPods.xcworkspace \
-scheme RNTester \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
-derivedDataPath "/tmp/RNTesterBuild" \
-resultBundlePath "/tmp/RNTesterTestResults" \
"${SKIPPED_TESTS[@]}"
}
buildForTesting() {
# shellcheck disable=SC1091
source "$ROOT/scripts/.tests.env"
bundle install
bundle exec pod install
xcodebuild build-for-testing \
-workspace RNTesterPods.xcworkspace \
-scheme RNTester \
-sdk iphonesimulator
}
runTestsOnly() {
# shellcheck disable=SC1091
source "$ROOT/scripts/.tests.env"
echo "[Testing] Running tests on $IOS_DEVICE for OS $IOS_TARGET_OS"
xcodebuild test \
-workspace RNTesterPods.xcworkspace \
-scheme RNTester \
-sdk iphonesimulator \
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS" \
"${SKIPPED_TESTS[@]}"
-derivedDataPath "/tmp/RNTesterBuild" \
-destination "platform=iOS Simulator,name=$IOS_DEVICE,OS=$IOS_TARGET_OS"
}
buildProject() {