Files
T
artus9033 2ce368604a 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
2025-12-10 08:47:16 -08:00

75 lines
2.0 KiB
Ruby

require_relative '../react-native/scripts/react_native_pods'
source 'https://cdn.cocoapods.org/'
platform :ios, min_ios_version_supported
cmake_path = `command -v cmake`
if cmake_path == ""
brew_path = `command -v brew`
if brew_path != ""
Pod::UI.puts "Installing CMake using brew. This is required to build RNTester.".red
`brew install cmake`
else
Pod::UI.puts "In order to build RNTester locally, you need cmake installed, please install it and try again".red
return
end
else
Pod::UI.puts "Cmake found at: #{cmake_path}".green
end
prepare_react_native_project!
@prefix_path = "../react-native"
linkage = ENV['USE_FRAMEWORKS']
USE_FRAMEWORKS = linkage != nil
if USE_FRAMEWORKS
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end
def pods(target_name, options = {})
project 'RNTesterPods.xcodeproj'
fabric_enabled = true
use_react_native!(
path: @prefix_path,
fabric_enabled: fabric_enabled,
app_path: "#{Dir.pwd}",
config_file_dir: "#{Dir.pwd}/node_modules",
production: false, #deprecated
)
pod 'ReactCommon-Samples', :path => "#{@prefix_path}/ReactCommon/react/nativemodule/samples"
# Additional Pods which aren't included in the default Podfile
pod 'React-RCTPushNotification', :path => "#{@prefix_path}/Libraries/PushNotificationIOS"
# Additional Pods which are classed as unstable
# RNTester native modules and components
pod 'ScreenshotManager', :path => "NativeModuleExample"
pod 'MyNativeView', :path => "NativeComponentExample"
pod 'NativeCxxModuleExample', :path => "NativeCxxModuleExample"
end
target 'RNTester' do
pods('RNTester')
end
target 'RNTesterUnitTests' do
pods('RNTesterUnitTests')
pod 'React-RCTTest', :path => "./RCTTest"
pod 'OCMock', '~> 3.9.1'
end
target 'RNTesterIntegrationTests' do
pods('RNTesterIntegrationTests')
pod 'React-RCTTest', :path => "./RCTTest"
end
post_install do |installer|
react_native_post_install(installer, @prefix_path, :mac_catalyst_enabled => false)
end