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 authored and meta-codesync[bot] committed 2025-12-10 08:47:16 -08:00
1 parent 700d320a5f
commit 2ce368604a
40 files changed
+360 -297

No files matched your search

+6 -7
View File
@@ -6,7 +6,7 @@ inputs:
default: 2.6.10
run-unit-tests:
description: whether unit tests should run or not.
default: "false"
default: "true"
flavor:
description: The flavor of the build. Must be one of "Debug", "Release".
default: Debug
@@ -104,15 +104,14 @@ runs:
shell: bash
run: |
echo "zipping tests results"
cd /Users/distiller/Library/Developer/Xcode
XCRESULT_PATH=$(find . -name '*.xcresult')
tar -zcvf xcresults.tar.gz $XCRESULT_PATH
cd /Users/runner/Library/Developer/Xcode
tar -zcvf xcresults.tar.gz "/tmp/RNTesterTestResults"
- name: Upload artifact
uses: actions/upload-artifact@v4.3.4
if: ${{ inputs.run-unit-tests == 'true' }}
with:
name: xcresults
path: /Users/distiller/Library/Developer/Xcode/xcresults.tar.gz
name: xcresults-${{ inputs.flavor }}-${{ inputs.use-frameworks == 'true' && 'dynamic-frameworks' || 'static-libraries' }}-Ruby${{ inputs.ruby-version }}
path: /Users/runner/Library/Developer/Xcode/xcresults.tar.gz
- name: Upload RNTester App
if: ${{ inputs.use-frameworks == 'false' && inputs.ruby-version == '2.6.10' }} # This is needed to avoid conflicts with the artifacts
uses: actions/upload-artifact@v4.3.4
@@ -123,5 +122,5 @@ runs:
if: ${{ inputs.run-unit-tests == 'true' }}
uses: actions/upload-artifact@v4.3.4
with:
name: test-results
name: test-results-${{ inputs.flavor }}-${{ inputs.use-frameworks == 'true' && 'dynamic-frameworks' || 'static-libraries' }}-Ruby${{ inputs.ruby-version }}
path: ./reports/junit
+2 -2
View File
@@ -70,9 +70,9 @@ jobs:
- name: Run it
uses: ./.github/actions/test-ios-rntester
with:
flavor: Debug
flavor: ${{ matrix.flavor }}
use-frameworks: true
run-unit-tests: false # tests for dynamic frameworks are already run in the test_ios_rntester job; this is to just a test build from source (no prebuilds)
test_ios_rntester:
runs-on: macos-15-large
@@ -369,7 +369,7 @@ static RCTBridge *RCTCurrentBridgeInstance = nil;
moduleProvider:(RCTBridgeModuleListProvider)block
launchOptions:(NSDictionary *)launchOptions
{
// Only enabld this assertion in OSS
// Only enable this assertion in OSS
#if COCOAPODS
[RCTBridge throwIfOnLegacyArch];
#endif
+1 -1
View File
@@ -706,7 +706,7 @@ NSURL *RCTDataURL(NSString *mimeType, NSData *data)
[data base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0]]];
}
BOOL RCTIsGzippedData(NSData *__nullable /*data*/); // exposed for unit testing purposes
extern "C" BOOL RCTIsGzippedData(NSData *__nullable /*data*/); // exposed for unit testing purposes
BOOL RCTIsGzippedData(NSData *__nullable data)
{
UInt8 *bytes = (UInt8 *)data.bytes;
@@ -33,7 +33,6 @@ class CodegenUtilsTests < Test::Unit::TestCase
def setup
CodegenUtils.set_react_codegen_discovery_done(false)
CodegenUtils.set_react_codegen_podspec_generated(false)
Pod::Config.reset()
@base_path = "~/app/ios"
Pathname.pwd!(@base_path)
@@ -62,8 +61,8 @@ class CodegenUtilsTests < Test::Unit::TestCase
# Assert
assert_false(CodegenUtils.react_codegen_discovery_done())
assert_equal(Pod::UI.collected_messages, [])
assert_equal(Pod::UI.collected_warns, [])
assert_equal([], Pod::UI.collected_messages)
assert_equal([], Pod::UI.collected_warns)
end
def testUseReactCodegenDiscovery_whenDiscoveryDone_doNothing
@@ -75,8 +74,8 @@ class CodegenUtilsTests < Test::Unit::TestCase
# Assert
assert_true(CodegenUtils.react_codegen_discovery_done())
assert_equal(Pod::UI.collected_messages, ["Skipping use_react_native_codegen_discovery."])
assert_equal(Pod::UI.collected_warns, [])
assert_equal(["Skipping use_react_native_codegen_discovery."], Pod::UI.collected_messages)
assert_equal([], Pod::UI.collected_warns)
end
def testUseReactCodegenDiscovery_whenAppPathUndefined_abort
@@ -89,16 +88,16 @@ class CodegenUtilsTests < Test::Unit::TestCase
# Assert
assert_false(CodegenUtils.react_codegen_discovery_done())
assert_equal(Pod::UI.collected_messages, [])
assert_equal(Pod::UI.collected_warns, [
assert_equal([], Pod::UI.collected_messages)
assert_equal([
'Error: app_path is required for use_react_native_codegen_discovery.',
'If you are calling use_react_native_codegen_discovery! in your Podfile, please remove the call and pass `app_path` and/or `config_file_dir` to `use_react_native!`.'
])
], Pod::UI.collected_warns)
end
# ============================= #
# =========================== #
# Test - CleanUpCodegenFolder #
# ============================= #
# =========================== #
def testCleanUpCodegenFolder_whenCleanupDone_doNothing
# Arrange
@@ -110,9 +109,9 @@ class CodegenUtilsTests < Test::Unit::TestCase
CodegenUtils.clean_up_build_folder(rn_path, codegen_dir, dir_manager: DirMock, file_manager: FileMock)
# Assert
assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 0)
assert_equal(FileUtils::FileUtilsStorage.rmrf_paths, [])
assert_equal(CodegenUtils.cleanup_done(), true)
assert_equal(0, FileUtils::FileUtilsStorage.rmrf_invocation_count)
assert_equal([], FileUtils::FileUtilsStorage.rmrf_paths)
assert_equal(true, CodegenUtils.cleanup_done())
end
def testCleanUpCodegenFolder_whenFolderDoesNotExists_markAsCleanupDone
@@ -125,10 +124,10 @@ class CodegenUtilsTests < Test::Unit::TestCase
CodegenUtils.clean_up_build_folder(rn_path, codegen_dir, dir_manager: DirMock, file_manager: FileMock)
# Assert
assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 0)
assert_equal(FileUtils::FileUtilsStorage.rmrf_paths, [])
assert_equal(DirMock.glob_invocation, [])
assert_equal(CodegenUtils.cleanup_done(), true)
assert_equal(0, FileUtils::FileUtilsStorage.rmrf_invocation_count)
assert_equal([], FileUtils::FileUtilsStorage.rmrf_paths)
assert_equal([], DirMock.glob_invocation)
assert_equal(true, CodegenUtils.cleanup_done())
end
def testCleanUpCodegenFolder_whenFolderExists_deleteItAndSetCleanupDone
@@ -137,29 +136,33 @@ class CodegenUtilsTests < Test::Unit::TestCase
codegen_dir = "build/generated/ios"
codegen_path = "#{@base_path}/#{codegen_dir}"
globs = [
"/MyModuleSpecs/MyModule.h",
"#{codegen_path}/MyModuleSpecs/MyModule.mm",
"#{codegen_path}/react/components/MyComponent/ShadowNode.h",
"#{codegen_path}/react/components/MyComponent/ShadowNode.mm",
codegen_path
]
rn_path = '../node_modules/react-native'
DirMock.mocked_existing_dirs(codegen_path)
DirMock.mocked_existing_globs(globs, "#{codegen_path}/*")
original_define_singleton_method = CodegenUtils.method(:assert_codegen_folder_is_empty)
CodegenUtils.define_singleton_method(:assert_codegen_folder_is_empty) do |*args, **kwargs|
# no-op
end
# Act
CodegenUtils.clean_up_build_folder(rn_path, codegen_dir, dir_manager: DirMock, file_manager: FileMock)
# Assert
assert_equal(DirMock.exist_invocation_params, [codegen_path, codegen_path])
assert_equal(DirMock.glob_invocation, ["#{codegen_path}/*", "#{codegen_path}/*"])
assert_equal(FileUtils::FileUtilsStorage.rmrf_invocation_count, 3)
assert_equal(FileUtils::FileUtilsStorage.rmrf_paths, [
globs,
assert_equal([codegen_path], DirMock.exist_invocation_params)
assert_equal(3, FileUtils::FileUtilsStorage.rmrf_invocation_count)
assert_equal([
*globs,
"#{rn_path}/React/Fabric/RCTThirdPartyFabricComponentsProvider.h",
"#{rn_path}/React/Fabric/RCTThirdPartyFabricComponentsProvider.mm",
])
assert_equal(CodegenUtils.cleanup_done(), true)
], FileUtils::FileUtilsStorage.rmrf_paths)
assert_equal(true, CodegenUtils.cleanup_done())
ensure
# Restore original method so other tests are not affected
CodegenUtils.define_singleton_method(:assert_codegen_folder_is_empty, original_define_singleton_method)
end
# ===================================== #
@@ -175,7 +178,7 @@ class CodegenUtilsTests < Test::Unit::TestCase
CodegenUtils.assert_codegen_folder_is_empty(codegen_path, dir_manager: DirMock)
# Assert
assert_equal(Pod::UI.collected_warns, [])
assert_equal([], Pod::UI.collected_warns)
end
def test_assertCodegenFolderIsEmpty_whenItExistsAndIsEmpty_doesNotAbort
@@ -189,7 +192,7 @@ class CodegenUtilsTests < Test::Unit::TestCase
CodegenUtils.assert_codegen_folder_is_empty(codegen_path, dir_manager: DirMock)
# Assert
assert_equal(Pod::UI.collected_warns, [])
assert_equal([], Pod::UI.collected_warns)
end
def test_assertCodegenFolderIsEmpty_whenItIsNotEmpty_itAborts
@@ -205,9 +208,9 @@ class CodegenUtilsTests < Test::Unit::TestCase
}
# Assert
assert_equal(Pod::UI.collected_warns, [
assert_equal([
"Unable to remove the content of ~/app/ios/./build/generated/ios folder. Please run rm -rf ~/app/ios/./build/generated/ios and try again."
])
], Pod::UI.collected_warns)
end
private
@@ -52,6 +52,6 @@ class FabricTest < Test::Unit::TestCase
if modular_headers != nil then expected_params[:modular_headers] = modular_headers end
if podspec != nil then expected_params[:podspec] = podspec end
assert_equal(params, expected_params)
assert_equal(expected_params, params)
end
end
@@ -37,12 +37,11 @@ class JSEngineTests < Test::Unit::TestCase
setup_hermes!(:react_native_path => @react_native_path)
# Assert
assert_equal($podInvocationCount, 3)
assert_equal($podInvocation["React-jsi"][:path], "../../ReactCommon/jsi")
assert_equal(2, $podInvocationCount)
hermes_engine_pod_invocation = $podInvocation["hermes-engine"]
assert_equal(hermes_engine_pod_invocation[:podspec], "../../sdks/hermes-engine/hermes-engine.podspec")
assert_equal(hermes_engine_pod_invocation[:tag], "")
assert_equal($podInvocation["React-hermes"][:path], "../../ReactCommon/hermes")
assert_equal("../../sdks/hermes-engine/hermes-engine.podspec", hermes_engine_pod_invocation[:podspec])
assert_equal("", hermes_engine_pod_invocation[:tag])
assert_equal("../../ReactCommon/hermes", $podInvocation["React-hermes"][:path])
end
end
@@ -34,12 +34,12 @@ class LocalPodspecPatchTests < Test::Unit::TestCase
local_podspec = LocalPodspecPatch.pods_to_update(:react_native_path => react_native_path, dir_manager: DirMock, file_manager: FileMock)
# Assert
assert_equal(local_podspec, [])
assert_equal(DirMock.glob_invocation, ["#{react_native_path}/third-party-podspecs/*"])
assert_equal(FileMock.exist_invocation_params, [
assert_equal([], local_podspec)
assert_equal(["#{react_native_path}/third-party-podspecs/*"], DirMock.glob_invocation)
assert_equal([
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "boost.podspec.json"),
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "DoubleConversion.podspec.json"),
])
], FileMock.exist_invocation_params)
end
def test_podsToUpdate_whenFilesExistsWithSameVersions_returnsEmpty
@@ -53,12 +53,12 @@ class LocalPodspecPatchTests < Test::Unit::TestCase
local_podspec = LocalPodspecPatch.pods_to_update(:react_native_path => react_native_path, dir_manager: DirMock, file_manager: FileMock)
# Assert
assert_equal(local_podspec, [])
assert_equal(DirMock.glob_invocation, ["#{react_native_path}/third-party-podspecs/*"])
assert_equal(FileMock.exist_invocation_params, [
assert_equal([], local_podspec)
assert_equal(["#{react_native_path}/third-party-podspecs/*"], DirMock.glob_invocation)
assert_equal([
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "boost.podspec.json"),
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "DoubleConversion.podspec.json"),
])
], FileMock.exist_invocation_params)
end
def test_podsToUpdate_whenFilesExistsWithDifferentVersions_returnsThem
@@ -72,15 +72,15 @@ class LocalPodspecPatchTests < Test::Unit::TestCase
local_podspec = LocalPodspecPatch.pods_to_update(:react_native_path => react_native_path, dir_manager: DirMock, file_manager: FileMock)
# Assert
assert_equal(local_podspec, [
assert_equal([
"boost",
"DoubleConversion"
])
assert_equal(DirMock.glob_invocation, ["#{react_native_path}/third-party-podspecs/*"])
assert_equal(FileMock.exist_invocation_params, [
], local_podspec)
assert_equal(["#{react_native_path}/third-party-podspecs/*"], DirMock.glob_invocation)
assert_equal([
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "boost.podspec.json"),
FileMock.join(mocked_pwd, "Pods/Local Podspecs", "DoubleConversion.podspec.json"),
])
], FileMock.exist_invocation_params)
end
# ======================================== #
@@ -101,10 +101,10 @@ class LocalPodspecPatchTests < Test::Unit::TestCase
new_changes = Pod::Lockfile.new().patch_detect_changes_with_podfile(changes)
assert_equal(new_changes, {
assert_equal({
:unchanged => ["some_pod"],
:changed => ["boost", "DoubleConversion", "another_pod"]
})
}, new_changes)
end
def test_patchDetectChangesWithPodfile_whenLocalPodsUnchanged_movesLocalPodsToChangeSet()
@@ -122,10 +122,10 @@ class LocalPodspecPatchTests < Test::Unit::TestCase
new_changes = Pod::Lockfile.new().patch_detect_changes_with_podfile(changes)
assert_equal(new_changes, {
assert_equal({
:unchanged => ["first_pod"],
:changed => ["another_pod", "boost", "DoubleConversion"]
})
}, new_changes)
end
# ========= #
@@ -34,18 +34,18 @@ class NewArchitectureTests < Test::Unit::TestCase
installer = prepare_mocked_installer_with_react_core
NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
assert_equal(installer.aggregate_targets[0].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"], "c++20")
assert_equal(installer.aggregate_targets[1].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"], "c++20")
assert_equal(Pod::UI.collected_messages, ["Setting CLANG_CXX_LANGUAGE_STANDARD to c++20 on /test/path.xcproj", "Setting CLANG_CXX_LANGUAGE_STANDARD to c++20 on /test/path2.xcproj"])
assert_equal("c++20", installer.aggregate_targets[0].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"])
assert_equal("c++20", installer.aggregate_targets[1].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"])
assert_equal(["Setting CLANG_CXX_LANGUAGE_STANDARD to c++20 on /test/path.xcproj", "Setting CLANG_CXX_LANGUAGE_STANDARD to c++20 on /test/path2.xcproj"], Pod::UI.collected_messages)
end
def test_setClangCxxLanguageStandardIfNeeded_whenThereAreDifferentValuesForLanguageStandard_takesTheFirstValue
installer = prepare_mocked_installer_with_react_core_and_different_language_standards
NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
assert_equal(installer.aggregate_targets[0].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"], "c++20")
assert_equal(installer.aggregate_targets[1].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"], "c++20")
assert_equal(Pod::UI.collected_messages, ["Setting CLANG_CXX_LANGUAGE_STANDARD to c++20 on /test/path.xcproj", "Setting CLANG_CXX_LANGUAGE_STANDARD to c++20 on /test/path2.xcproj"])
assert_equal("c++20", installer.aggregate_targets[0].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"])
assert_equal("c++20", installer.aggregate_targets[1].user_project.build_configurations[0].build_settings["CLANG_CXX_LANGUAGE_STANDARD"])
assert_equal(["Setting CLANG_CXX_LANGUAGE_STANDARD to c++20 on /test/path.xcproj", "Setting CLANG_CXX_LANGUAGE_STANDARD to c++20 on /test/path2.xcproj"], Pod::UI.collected_messages)
end
# =================== #
@@ -71,14 +71,14 @@ class NewArchitectureTests < Test::Unit::TestCase
NewArchitectureHelper.modify_flags_for_new_architecture(installer, false)
# Assert
assert_equal(first_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -Wno-comma -Wno-shorten-64-to-32")
assert_equal(first_xcconfig.save_as_invocation, ["a/path/First.xcconfig"])
assert_equal(second_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -Wno-comma -Wno-shorten-64-to-32")
assert_equal(second_xcconfig.save_as_invocation, ["a/path/Second.xcconfig"])
assert_equal(react_core_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -Wno-comma -Wno-shorten-64-to-32")
assert_equal(react_core_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -Wno-comma -Wno-shorten-64-to-32")
assert_equal(yoga_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited)")
assert_equal(yoga_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited)")
assert_equal("$(inherited) ", first_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"])
assert_equal(["a/path/First.xcconfig"], first_xcconfig.save_as_invocation)
assert_equal("$(inherited) ", second_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"])
assert_equal(["a/path/Second.xcconfig"], second_xcconfig.save_as_invocation)
assert_equal("$(inherited) ", react_core_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"])
assert_equal("$(inherited) ", react_core_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"])
assert_equal("$(inherited)", yoga_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"])
assert_equal("$(inherited)", yoga_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"])
end
def test_modifyFlagsForNewArch_whenOnNewArchAndIsRelease_updateFlags
@@ -101,19 +101,19 @@ class NewArchitectureTests < Test::Unit::TestCase
NewArchitectureHelper.modify_flags_for_new_architecture(installer, true)
# Assert
assert_equal(first_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1")
assert_equal("$(inherited) -DRCT_NEW_ARCH_ENABLED=1 ", first_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"])
assert_nil(first_xcconfig.attributes["OTHER_CFLAGS"])
assert_equal(first_xcconfig.save_as_invocation, ["a/path/First.xcconfig"])
assert_equal(second_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1")
assert_equal(["a/path/First.xcconfig"], first_xcconfig.save_as_invocation)
assert_equal("$(inherited) -DRCT_NEW_ARCH_ENABLED=1 ", second_xcconfig.attributes["OTHER_CPLUSPLUSFLAGS"])
assert_nil(second_xcconfig.attributes["OTHER_CFLAGS"])
assert_equal(second_xcconfig.save_as_invocation, ["a/path/Second.xcconfig"])
assert_equal(react_core_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1")
assert_equal(["a/path/Second.xcconfig"], second_xcconfig.save_as_invocation)
assert_equal("$(inherited) -DRCT_NEW_ARCH_ENABLED=1 ", react_core_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"])
assert_nil(react_core_debug_config.build_settings["OTHER_CFLAGS"])
assert_equal(react_core_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1")
assert_equal("$(inherited) -DRCT_NEW_ARCH_ENABLED=1 ", react_core_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"])
assert_nil(react_core_release_config.build_settings["OTHER_CFLAGS"])
assert_equal(yoga_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited)")
assert_equal("$(inherited)", yoga_debug_config.build_settings["OTHER_CPLUSPLUSFLAGS"])
assert_nil(yoga_debug_config.build_settings["OTHER_CFLAGS"])
assert_equal(yoga_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"], "$(inherited)")
assert_equal("$(inherited)", yoga_release_config.build_settings["OTHER_CPLUSPLUSFLAGS"])
assert_nil(yoga_release_config.build_settings["OTHER_CFLAGS"])
end
@@ -125,22 +125,29 @@ class NewArchitectureTests < Test::Unit::TestCase
spec = SpecMock.new
# Act
ENV["RCT_NEW_ARCH_ENABLED"] = "1"
NewArchitectureHelper.install_modules_dependencies(spec, true, '2024.10.14.00')
# Assert
folly_config = Helpers::Constants.folly_config
folly_compiler_flags = folly_config[:compiler_flags]
assert_equal(spec.compiler_flags, "-DRCT_NEW_ARCH_ENABLED=1")
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/fast_float/include\" \"$(PODS_ROOT)/fmt/include\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-featureflags/React_featureflags.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-ImageManager/React_ImageManager.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-rendererdebug/React_rendererdebug.framework/Headers\"")
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++20")
assert_equal(spec.pod_target_xcconfig["OTHER_CPLUSPLUSFLAGS"], "$(inherited) -DRCT_NEW_ARCH_ENABLED=1")
assert_equal("-DRCT_NEW_ARCH_ENABLED=1", spec.compiler_flags)
assert_equal(
[
"\"$(PODS_ROOT)/Headers/Private/Yoga\"",
"$(PODS_ROOT)/glog",
"$(PODS_ROOT)/boost",
"$(PODS_ROOT)/DoubleConversion",
"$(PODS_ROOT)/fast_float/include",
"$(PODS_ROOT)/fmt/include",
"$(PODS_ROOT)/SocketRocket",
"$(PODS_ROOT)/RCT-Folly"
],
spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"]
)
assert_equal("c++20", spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"])
assert_equal("$(inherited) -DRCT_NEW_ARCH_ENABLED=1 ", spec.pod_target_xcconfig["OTHER_CPLUSPLUSFLAGS"])
assert_equal(
spec.dependencies,
[
{ :dependency_name => "React-Core" },
{ :dependency_name => "ReactNativeDependencies" },
{ :dependency_name => "glog" },
{ :dependency_name => "React-RCTFabric" },
{ :dependency_name => "ReactCodegen" },
{ :dependency_name => "RCTRequired" },
@@ -156,33 +163,42 @@ class NewArchitectureTests < Test::Unit::TestCase
{ :dependency_name => "React-debug" },
{ :dependency_name => "React-ImageManager" },
{ :dependency_name => "React-rendererdebug" },
{ :dependency_name => "React-jsi" },
{ :dependency_name => "React-renderercss" },
{ :dependency_name => "hermes-engine" },
{ :dependency_name => "glog" },
{ :dependency_name => "boost" },
{ :dependency_name => "DoubleConversion" },
{ :dependency_name => "hermes-engine" }
])
{ :dependency_name => "fast_float" },
{ :dependency_name => "fmt" },
{ :dependency_name => "RCT-Folly" },
{ :dependency_name => "SocketRocket" },
{ :dependency_name => "RCT-Folly/Fabric" },
],
spec.dependencies
)
end
def test_installModulesDependencies_whenNewArchDisabledAndSearchPathsAndCompilerFlagsArePresent_itInstallDependenciesAndPreserveOtherSettings
# Arrange
spec = SpecMock.new
spec.compiler_flags = ''
other_flags = "\"$(ReactNativeDependencies)/boost\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCodegen/ReactCodegen.framework/Headers\""
other_flags_arr = ["\"$(ReactNativeDependencies)/boost\"", "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCodegen/ReactCodegen.framework/Headers\""]
spec.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => other_flags
"HEADER_SEARCH_PATHS" => other_flags_arr.join(" ")
}
# Act
ENV["RCT_NEW_ARCH_ENABLED"] = nil
NewArchitectureHelper.install_modules_dependencies(spec, false, '2024.10.14.00')
# Assert
assert_equal(Helpers::Constants.folly_config[:compiler_flags], "#{NewArchitectureHelper.folly_compiler_flags}")
assert_equal(spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"], "#{other_flags} \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/Headers/Private/Yoga\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/fast_float/include\" \"$(PODS_ROOT)/fmt/include\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-NativeModulesApple/React_NativeModulesApple.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-utils/React_utils.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-featureflags/React_featureflags.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-debug/React_debug.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-ImageManager/React_ImageManager.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-rendererdebug/React_rendererdebug.framework/Headers\"")
assert_equal(spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"], "c++20")
assert_equal("#{NewArchitectureHelper.folly_compiler_flags}", Helpers::Constants.folly_config[:compiler_flags])
assert_equal([*other_flags_arr, '"$(PODS_ROOT)/Headers/Private/Yoga"', '$(PODS_ROOT)/glog', '$(PODS_ROOT)/boost', '$(PODS_ROOT)/DoubleConversion', '$(PODS_ROOT)/fast_float/include', '$(PODS_ROOT)/fmt/include', '$(PODS_ROOT)/SocketRocket', '$(PODS_ROOT)/RCT-Folly'], spec.pod_target_xcconfig["HEADER_SEARCH_PATHS"])
assert_equal("c++20", spec.pod_target_xcconfig["CLANG_CXX_LANGUAGE_STANDARD"])
assert_equal(
spec.dependencies,
[
{ :dependency_name => "React-Core" },
{ :dependency_name => "RCT-Folly", "version"=>"2024.10.14.00" },
{ :dependency_name => "glog" },
{ :dependency_name => "React-RCTFabric" },
{ :dependency_name => "ReactCodegen" },
{ :dependency_name => "RCTRequired" },
@@ -198,9 +214,18 @@ class NewArchitectureTests < Test::Unit::TestCase
{ :dependency_name => "React-debug" },
{ :dependency_name => "React-ImageManager" },
{ :dependency_name => "React-rendererdebug" },
{ :dependency_name => "React-jsi" },
{ :dependency_name => "React-renderercss" },
{ :dependency_name => "hermes-engine" },
{ :dependency_name => "glog" },
{ :dependency_name => "boost" },
{ :dependency_name => "DoubleConversion" },
{ :dependency_name => "hermes-engine" }
]
{ :dependency_name => "fast_float" },
{ :dependency_name => "fmt" },
{ :dependency_name => "RCT-Folly" },
{ :dependency_name => "SocketRocket" },
],
spec.dependencies
)
end
@@ -17,5 +17,5 @@ module Xcodeproj
def self.reset()
@@path_to_file_mapping.clear
end
end
end
end
@@ -14,8 +14,8 @@
# variable. A $podInvocationCount counter is increased as well.
#
# You can assert against these variables to check:
# * The `pod` function has been invoked X times: `assert_equal($podInvocationCount, X)`
# * A specific pod has been installed: `assert_equal($podInvocation["MyPod"][:version], "15.4.6")`
# * The `pod` function has been invoked X times: `assert_equal(X, $podInvocationCount)`
# * A specific pod has been installed: `assert_equal("15.4.6", $podInvocation["MyPod"][:version])`
$podInvocation = {}
@@ -52,8 +52,8 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.warn_if_not_on_arm64()
# Assert
assert_equal(Pod::UI.collected_messages, [])
assert_equal(Pod::UI.collected_warns, [])
assert_equal([], Pod::UI.collected_messages)
assert_equal([], Pod::UI.collected_warns)
end
@@ -66,8 +66,8 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.warn_if_not_on_arm64()
# Assert
assert_equal(Pod::UI.collected_messages, [])
assert_equal(Pod::UI.collected_warns, [])
assert_equal([], Pod::UI.collected_messages)
assert_equal([], Pod::UI.collected_warns)
end
def test_warnIfNotOnArm64_whenSysctlReturns1AndRubyNotIncludeArm64_warns
@@ -79,13 +79,13 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.warn_if_not_on_arm64()
# Assert
assert_equal(Pod::UI.collected_messages, [])
assert_equal(Pod::UI.collected_warns, [
assert_equal([], Pod::UI.collected_messages)
assert_equal([
'Do not use "pod install" from inside Rosetta2 (x86_64 emulation on arm64).',
' - Emulated x86_64 is slower than native arm64',
' - May result in mixed architectures in rubygems (eg: ffi_c.bundle files may be x86_64 with an arm64 interpreter)',
'Run "env /usr/bin/arch -arm64 /bin/bash --login" then try again.',
])
], Pod::UI.collected_warns)
end
# ====================== #
@@ -99,10 +99,10 @@ class UtilsTests < Test::Unit::TestCase
flags = ReactNativePodsUtils.get_default_flags()
# Assert
assert_equal(flags, {
assert_equal({
:fabric_enabled => false,
:hermes_enabled => true,
})
}, flags)
end
def test_getDefaultFlag_whenNewArchitecture()
@@ -113,10 +113,10 @@ class UtilsTests < Test::Unit::TestCase
flags = ReactNativePodsUtils.get_default_flags()
# Assert
assert_equal(flags, {
assert_equal({
:fabric_enabled => true,
:hermes_enabled => true,
})
}, flags)
end
# ============== #
@@ -130,7 +130,7 @@ class UtilsTests < Test::Unit::TestCase
result = ReactNativePodsUtils.has_pod(installer, "some_pod")
# Assert
assert_equal(result, false)
assert_equal(false, result)
end
@@ -142,7 +142,7 @@ class UtilsTests < Test::Unit::TestCase
result = ReactNativePodsUtils.has_pod(installer, "some_pod")
# Assert
assert_equal(result, true)
assert_equal(true, result)
end
# ======================================================== #
@@ -230,7 +230,7 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.fix_library_search_path(buildConfig)
# Assert
assert_equal(buildConfig.build_settings["LIBRARY_SEARCH_PATHS"], ["$(SDKROOT)/usr/lib/swift"])
assert_equal(["$(SDKROOT)/usr/lib/swift"], buildConfig.build_settings["LIBRARY_SEARCH_PATHS"])
end
def test_fixLibrarySearchPath_whenThereAreSearchPathsAndSwiftEscaped_removesSwift5_5
@@ -246,7 +246,7 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.fix_library_search_path(buildConfig)
# Assert
assert_equal(buildConfig.build_settings["LIBRARY_SEARCH_PATHS"], ["another/path", "\"$(SDKROOT)/usr/lib/swift\""])
assert_equal(["another/path", "\"$(SDKROOT)/usr/lib/swift\""], buildConfig.build_settings["LIBRARY_SEARCH_PATHS"])
end
def test_fixLibrarySearchPath_whenThereAreSearchPathsAndNoSwift_removesSwift5_5AndAddsSwiftAsFirst
@@ -259,7 +259,7 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.fix_library_search_path(buildConfig)
# Assert
assert_equal(buildConfig.build_settings["LIBRARY_SEARCH_PATHS"], ["$(SDKROOT)/usr/lib/swift", "another/path"])
assert_equal(["$(SDKROOT)/usr/lib/swift", "another/path"], buildConfig.build_settings["LIBRARY_SEARCH_PATHS"])
end
# ============================== #
@@ -291,29 +291,29 @@ class UtilsTests < Test::Unit::TestCase
# Assert
user_project_mock.build_configurations.each do |config|
assert_equal(config.build_settings["LIBRARY_SEARCH_PATHS"], [
assert_equal([
"$(SDKROOT)/usr/lib/swift", "another/path"
])
], config.build_settings["LIBRARY_SEARCH_PATHS"])
end
user_project_mock.native_targets.each do |target|
target.build_configurations.each do |config|
assert_equal(config.build_settings["LIBRARY_SEARCH_PATHS"], [
assert_equal([
"$(SDKROOT)/usr/lib/swift", "another/path"
])
], config.build_settings["LIBRARY_SEARCH_PATHS"])
end
end
pods_projects_mock.native_targets.each do |target|
target.build_configurations.each do |config|
assert_equal(config.build_settings["LIBRARY_SEARCH_PATHS"], [
assert_equal([
"$(SDKROOT)/usr/lib/swift", "another/path"
])
], config.build_settings["LIBRARY_SEARCH_PATHS"])
end
end
assert_equal(user_project_mock.save_invocation_count, 1)
assert_equal(pods_projects_mock.save_invocation_count, 1)
assert_equal(1, user_project_mock.save_invocation_count)
assert_equal(1, pods_projects_mock.save_invocation_count)
end
# ===================================== #
@@ -363,13 +363,13 @@ class UtilsTests < Test::Unit::TestCase
# Assert
# these must have changed
assert_equal(react_core_debug_config.build_settings["CODE_SIGNING_ALLOWED"], "NO")
assert_equal(react_core_release_config.build_settings["CODE_SIGNING_ALLOWED"], "NO")
assert_equal("NO", react_core_debug_config.build_settings["CODE_SIGNING_ALLOWED"])
assert_equal("NO", react_core_release_config.build_settings["CODE_SIGNING_ALLOWED"])
# these needs to stay the same
assert_equal(hermes_engine_debug_config.build_settings["CODE_SIGNING_ALLOWED"], "NO")
assert_equal(hermes_engine_release_config.build_settings["CODE_SIGNING_ALLOWED"], "NO")
assert_equal(assets_debug_config.build_settings["CODE_SIGNING_ALLOWED"], "YES")
assert_equal(assets_release_config.build_settings["CODE_SIGNING_ALLOWED"], "YES")
assert_equal("NO", hermes_engine_debug_config.build_settings["CODE_SIGNING_ALLOWED"])
assert_equal("NO", hermes_engine_release_config.build_settings["CODE_SIGNING_ALLOWED"])
assert_equal("YES", assets_debug_config.build_settings["CODE_SIGNING_ALLOWED"])
assert_equal("YES", assets_release_config.build_settings["CODE_SIGNING_ALLOWED"])
end
# ================================= #
@@ -407,18 +407,18 @@ class UtilsTests < Test::Unit::TestCase
end
third_target.build_configurations.each do |config|
assert_equal(config.build_settings["CODE_SIGN_IDENTITY[sdk=macosx*]"], "-")
assert_equal("-", config.build_settings["CODE_SIGN_IDENTITY[sdk=macosx*]"])
end
user_project_mock.native_targets.each do |target|
target.build_configurations.each do |config|
assert_equal(config.build_settings["DEAD_CODE_STRIPPING"], "YES")
assert_equal(config.build_settings["PRESERVE_DEAD_CODE_INITS_AND_TERMS"], "YES")
assert_equal(config.build_settings["LIBRARY_SEARCH_PATHS"], ["$(SDKROOT)/usr/lib/swift", "$(SDKROOT)/System/iOSSupport/usr/lib/swift", "$(inherited)"])
assert_equal("YES", config.build_settings["DEAD_CODE_STRIPPING"])
assert_equal("YES", config.build_settings["PRESERVE_DEAD_CODE_INITS_AND_TERMS"])
assert_equal(["$(SDKROOT)/usr/lib/swift", "$(SDKROOT)/System/iOSSupport/usr/lib/swift", "$(inherited)"], config.build_settings["LIBRARY_SEARCH_PATHS"])
end
end
assert_equal(user_project_mock.save_invocation_count, 1)
assert_equal(1, user_project_mock.save_invocation_count)
end
# ==================================== #
@@ -439,12 +439,12 @@ class UtilsTests < Test::Unit::TestCase
# Assert
user_project_mock.build_configurations.each do |config|
assert_equal(config.build_settings["TEST_SETTING"], ["Test"])
assert_equal(["Test"], config.build_settings["TEST_SETTING"])
end
assert_equal(user_project_mock.save_invocation_count, 1)
assert_equal(pods_projects_mock.save_invocation_count, 1)
assert_equal(Pod::UI.collected_messages, ["Setting TEST_SETTING build settings"])
assert_equal(1, user_project_mock.save_invocation_count)
assert_equal(1, pods_projects_mock.save_invocation_count)
assert_equal(["Setting TEST_SETTING build settings"], Pod::UI.collected_messages)
end
# ==================================== #
@@ -466,13 +466,13 @@ class UtilsTests < Test::Unit::TestCase
# Assert
user_project_mock.build_configurations.each do |config|
if config.name == "Debug" then
assert_equal(config.build_settings["TEST_SETTING"], ["Test"])
assert_equal(["Test"], config.build_settings["TEST_SETTING"])
end
end
assert_equal(user_project_mock.save_invocation_count, 1)
assert_equal(pods_projects_mock.save_invocation_count, 1)
assert_equal(Pod::UI.collected_messages, ["Setting TEST_SETTING build settings"])
assert_equal(1, user_project_mock.save_invocation_count)
assert_equal(1, pods_projects_mock.save_invocation_count)
assert_equal(["Setting TEST_SETTING build settings"], Pod::UI.collected_messages)
end
# =================================== #
@@ -485,8 +485,8 @@ class UtilsTests < Test::Unit::TestCase
# Act
ReactNativePodsUtils.create_xcode_env_if_missing(file_manager: FileMock)
# Assert
assert_equal(FileMock.exist_invocation_params, ["/.xcode.env", "/.xcode.env.local"])
assert_equal($collected_commands, [])
assert_equal(["/.xcode.env", "/.xcode.env.local"], FileMock.exist_invocation_params)
assert_equal([], $collected_commands)
end
def test_createXcodeEnvIfMissing_whenTheyAreNotPresent_createsThem
@@ -495,8 +495,8 @@ class UtilsTests < Test::Unit::TestCase
# Act
ReactNativePodsUtils.create_xcode_env_if_missing(file_manager: FileMock)
# Assert
assert_equal(FileMock.exist_invocation_params, ["/.xcode.env", "/.xcode.env.local"])
assert_equal($collected_commands[0], "echo 'export NODE_BINARY=$(command -v node)' > /.xcode.env")
assert_equal(["/.xcode.env", "/.xcode.env.local"], FileMock.exist_invocation_params)
assert_equal("echo 'export NODE_BINARY=$(command -v node)' > /.xcode.env", $collected_commands[0])
end
# ============================ #
@@ -511,7 +511,7 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.detect_use_frameworks(target_definition)
# Assert
assert_equal(Pod::UI.collected_messages, [])
assert_equal([], Pod::UI.collected_messages)
end
def test_detectUseFrameworks_whenEnvNotSetAndNotUsed_setEnvVarToNil
@@ -522,7 +522,7 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.detect_use_frameworks(target_definition)
# Assert
assert_equal(Pod::UI.collected_messages, ["Framework build type is static library"])
assert_equal(["Framework build type is static library"], Pod::UI.collected_messages)
assert_nil(ENV['USE_FRAMEWORKS'])
end
@@ -534,8 +534,8 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.detect_use_frameworks(target_definition)
# Assert
assert_equal(Pod::UI.collected_messages, ["Framework build type is static framework"])
assert_equal(ENV['USE_FRAMEWORKS'], 'static')
assert_equal(["Framework build type is static framework"], Pod::UI.collected_messages)
assert_equal('static', ENV['USE_FRAMEWORKS'])
end
def test_detectUseFrameworks_whenEnvNotSetAndDynamicFrameworks_setEnvVarToDynamic
@@ -546,8 +546,8 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.detect_use_frameworks(target_definition)
# Assert
assert_equal(Pod::UI.collected_messages, ["Framework build type is dynamic framework"])
assert_equal(ENV['USE_FRAMEWORKS'], 'dynamic')
assert_equal(["Framework build type is dynamic framework"], Pod::UI.collected_messages)
assert_equal('dynamic', ENV['USE_FRAMEWORKS'])
end
# ============================ #
@@ -585,7 +585,7 @@ class UtilsTests < Test::Unit::TestCase
# Assert
user_project_mock.build_configurations.each do |config|
received_search_path = config.build_settings["HEADER_SEARCH_PATHS"]
expected_search_path = "$(inherited) ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers/platform/ios ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx ${PODS_CONFIGURATION_BUILD_DIR}/React-NativeModulesApple/React_NativeModulesApple.framework/Headers ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios"
expected_search_path = "$(inherited) ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core ${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers ${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers/platform/ios ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers ${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon-Samples/ReactCommon_Samples.framework/Headers/platform/ios ${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx ${PODS_CONFIGURATION_BUILD_DIR}/React-NativeModulesApple/React_NativeModulesApple.framework/Headers ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers ${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios"
assert_equal(expected_search_path, received_search_path)
end
@@ -593,8 +593,8 @@ class UtilsTests < Test::Unit::TestCase
if pod_name == "SecondTarget"
target_installation_result.native_target.build_configurations.each do |config|
received_search_path = config.build_settings["HEADER_SEARCH_PATHS"]
expected_Search_path = "$(inherited) \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/fast_float/include\" \"$(PODS_ROOT)/fmt/include\" \"$(PODS_ROOT)/boost\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCodegen/ReactCodegen.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/imagemanager/platform/ios\""
assert_equal(received_search_path, expected_Search_path)
expected_Search_path = "$(inherited) \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/fast_float/include\" \"$(PODS_ROOT)/fmt/include\" \"$(PODS_ROOT)/boost\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCodegen/ReactCodegen.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-runtimeexecutor/React_runtimeexecutor.framework/Headers/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-FabricImage/React_FabricImage.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Graphics/React_graphics.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/imagemanager/platform/ios\""
assert_equal(expected_Search_path, received_search_path)
end
else
target_installation_result.native_target.build_configurations.each do |config|
@@ -706,18 +706,18 @@ class UtilsTests < Test::Unit::TestCase
def test_creatHeaderSearchPathForFrameworks_whenNoPlatformsAndNoExtraPath_createsPlainSearchPath
result = ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-RCTFabric", "RCTFabric", [])
assert_equal(result, [
assert_equal([
"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers"
])
], result)
end
def test_creatHeaderSearchPathForFrameworks_whenNoPlatformsAndExtraPath_createsPlainSearchPath
result = ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"])
assert_equal(result, [
assert_equal([
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
])
], result)
end
def test_creatHeaderSearchPathForFrameworks_whenEmptyPlatformsAndExtraPath_createsPlainSearchPath
@@ -725,10 +725,10 @@ class UtilsTests < Test::Unit::TestCase
result = ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"])
assert_equal(result, [
assert_equal([
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
])
], result)
end
def test_creatHeaderSearchPathForFrameworks_whenOnlyOnePlatformsAndExtraPath_createsPlainSearchPath
@@ -736,10 +736,10 @@ class UtilsTests < Test::Unit::TestCase
result = ReactNativePodsUtils.create_header_search_path_for_frameworks("PODS_CONFIGURATION_BUILD_DIR", "React-Fabric", "React_Fabric", ["react/renderer/components/view/platform/cxx"])
assert_equal(result, [
assert_equal([
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
])
], result)
end
def test_creatHeaderSearchPathForFrameworks_whenMultiplePlatformsAndExtraPath_createsPlainSearchPath
@@ -755,14 +755,14 @@ class UtilsTests < Test::Unit::TestCase
]
)
assert_equal(result, [
assert_equal([
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric-iOS/React_Fabric.framework/Headers",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric-iOS/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric-iOS/React_Fabric.framework/Headers/react/renderer/components/view/platform/ios",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric-macOS/React_Fabric.framework/Headers",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric-macOS/React_Fabric.framework/Headers/react/renderer/components/view/platform/cxx",
"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric-macOS/React_Fabric.framework/Headers/react/renderer/components/view/platform/ios",
])
], result)
end
# ===================== #
@@ -773,8 +773,8 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.add_dependency(spec, "React-Fabric", "PODS_CONFIGURATION_BUILD_DIR", "React_Fabric")
assert_equal(spec.dependencies, [{:dependency_name => "React-Fabric"}])
assert_equal(spec.to_hash["pod_target_xcconfig"], {"HEADER_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\""})
assert_equal([{:dependency_name => "React-Fabric"}], spec.dependencies)
assert_equal({"HEADER_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\""}, spec.to_hash["pod_target_xcconfig"])
end
def test_addDependency_whenNoHeaderSearchPathAndVersion_addsThem
@@ -782,8 +782,8 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.add_dependency(spec, "React-Fabric", "PODS_CONFIGURATION_BUILD_DIR", "React_Fabric", :additional_paths => [], :version => '1000.0.0')
assert_equal(spec.dependencies, [{:dependency_name => "React-Fabric", "version" => '1000.0.0'}])
assert_equal(spec.to_hash["pod_target_xcconfig"], {"HEADER_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\""})
assert_equal([{:dependency_name => "React-Fabric", "version" => '1000.0.0'}], spec.dependencies)
assert_equal({"HEADER_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\""}, spec.to_hash["pod_target_xcconfig"])
end
def test_addDependency_whenHeaderSearchPathAndVersion_addsThemMaintainingTheSearchPaths
@@ -792,8 +792,8 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.add_dependency(spec, "React-Fabric", "PODS_CONFIGURATION_BUILD_DIR", "React_Fabric", :additional_paths => [], :version => '1000.0.0')
assert_equal(spec.dependencies, [{:dependency_name => "React-Fabric", "version" => '1000.0.0'}])
assert_equal(spec.to_hash["pod_target_xcconfig"], {"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\""})
assert_equal([{:dependency_name => "React-Fabric", "version" => '1000.0.0'}], spec.dependencies)
assert_equal({"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\""}, spec.to_hash["pod_target_xcconfig"])
end
def test_addDependencies_whenHeaderSearchPathAndVersion_addsThemMaintainingTheSearchPaths
@@ -803,9 +803,8 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.add_dependency(spec, "React-Fabric", "PODS_CONFIGURATION_BUILD_DIR", "React_Fabric", :additional_paths => [], :version => '1000.0.0')
ReactNativePodsUtils.add_dependency(spec, "React-RCTFabric", "PODS_CONFIGURATION_BUILD_DIR", "RCTFabric", :additional_paths => [])
assert_equal(spec.dependencies, [{:dependency_name => "React-Fabric", "version" => '1000.0.0'}, {:dependency_name => "React-RCTFabric" }])
assert_equal(spec.to_hash["pod_target_xcconfig"], {
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\""})
assert_equal([{:dependency_name => "React-Fabric", "version" => '1000.0.0'}, {:dependency_name => "React-RCTFabric" }], spec.dependencies)
assert_equal({"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\""}, spec.to_hash["pod_target_xcconfig"])
end
def test_addDependencies_whenHeaderSearchPathAndVersionWithAdditionalPaths_addsThemMaintainingTheSearchPaths
@@ -815,9 +814,8 @@ class UtilsTests < Test::Unit::TestCase
ReactNativePodsUtils.add_dependency(spec, "React-Fabric", "PODS_CONFIGURATION_BUILD_DIR", "React_Fabric", :additional_paths => [], :version => '1000.0.0')
ReactNativePodsUtils.add_dependency(spec, "React-RCTFabric", "PODS_CONFIGURATION_BUILD_DIR", "RCTFabric", :additional_paths => ["react/renderer/components/view/platform/ios"])
assert_equal(spec.dependencies, [{:dependency_name => "React-Fabric", "version" => '1000.0.0'}, {:dependency_name => "React-RCTFabric" }])
assert_equal(spec.to_hash["pod_target_xcconfig"], {
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers/react/renderer/components/view/platform/ios\""})
assert_equal([{:dependency_name => "React-Fabric", "version" => '1000.0.0'}, {:dependency_name => "React-RCTFabric" }], spec.dependencies)
assert_equal({"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers/react/renderer/components/view/platform/ios\""}, spec.to_hash["pod_target_xcconfig"])
end
def test_addDependencies_whenHeaderSearchPathAndVersionWithAdditionalPathsAndPlatforms_addsThemMaintainingTheSearchPaths
@@ -840,9 +838,8 @@ class UtilsTests < Test::Unit::TestCase
.map { |sp| return "\"#{sp}\"" }
.join(" ")
assert_equal(spec.dependencies, [{:dependency_name => "React-Fabric", "version" => '1000.0.0'}, {:dependency_name => "React-RCTFabric" }])
assert_equal(spec.to_hash["pod_target_xcconfig"], {
"HEADER_SEARCH_PATHS" => expected_search_paths})
assert_equal([{:dependency_name => "React-Fabric", "version" => '1000.0.0'}, {:dependency_name => "React-RCTFabric" }], spec.dependencies)
assert_equal({"HEADER_SEARCH_PATHS" => expected_search_paths}, spec.to_hash["pod_target_xcconfig"])
end
def test_addDependencies_whenSubspecsAndHeaderSearchPathAndVersionWithAdditionalPathsAndPlatforms_addsThemMaintainingTheSearchPaths
@@ -862,9 +859,8 @@ class UtilsTests < Test::Unit::TestCase
.map { |sp| return "\"#{sp}\"" }
.join(" ")
assert_equal(spec.dependencies, [{:dependency_name => "ReactCommon/turbomodule/core"}])
assert_equal(spec.to_hash["pod_target_xcconfig"], {
"HEADER_SEARCH_PATHS" => expected_search_paths})
assert_equal([{:dependency_name => "ReactCommon/turbomodule/core"}], spec.dependencies)
assert_equal({"HEADER_SEARCH_PATHS" => expected_search_paths}, spec.to_hash["pod_target_xcconfig"])
end
def test_add_flag_to_map_with_inheritance_whenUsedWithBuildConfigBuildSettings
@@ -8,6 +8,8 @@ require 'json'
require_relative "./utils.rb"
require_relative "./helpers.rb"
require_relative "./jsengine.rb"
require_relative "./rndependencies.rb"
require_relative "./rncore.rb"
class NewArchitectureHelper
@@ -194,13 +194,13 @@ class ReactNativePodsUtils
installer.target_installation_results.pod_target_installation_results.each do |pod_name, target_installation_result|
if pod_name.to_s == target_pod_name
target_installation_result.native_target.build_configurations.each do |config|
if configuration_type == nil || (configuration_type != nil && config.type == configuration_type)
config.build_settings[settings_name] ||= '$(inherited) '
config.build_settings[settings_name] << settings_value
end
if configuration_type == nil || (configuration_type != nil && config.type == configuration_type)
config.build_settings[settings_name] ||= '$(inherited) '
config.build_settings[settings_name] << settings_value
end
end
end
end
end
def self.fix_library_search_path(config)
@@ -42,4 +42,4 @@ class TestScriptPhases < Test::Unit::TestCase
assert_equal(snap_get_script_phases_no_codegen_discovery, result)
end
end
end
@@ -50,6 +50,7 @@ Pod::Spec.new do |spec|
'folly/lang/Exception.cpp',
'folly/memory/ReentrantAllocator.cpp',
'folly/memory/detail/MallocImpl.cpp',
'folly/memory/SanitizeLeak.cpp',
'folly/net/NetOps.cpp',
'folly/portability/SysUio.cpp',
'folly/synchronization/SanitizeThread.cpp',
@@ -23,6 +23,16 @@ function AccessibilityManagerTest(): React.Node {
"NativeAccessibilityManager doesn't exist",
);
const subscription = DeviceEventEmitter.addListener(
'didUpdateDimensions',
update => {
// some of the updates may come from lifecycle methods, which would carry different values than the ones we set
if (update.window.fontScale === 4.0) {
TestModule.markTestPassed(true);
}
},
);
NativeAccessibilityManager.setAccessibilityContentSizeMultipliers({
extraSmall: 1.0,
small: 2.0,
@@ -38,13 +48,6 @@ function AccessibilityManagerTest(): React.Node {
accessibilityExtraExtraExtraLarge: 12.0,
});
const subscription = DeviceEventEmitter.addListener(
'didUpdateDimensions',
update => {
TestModule.markTestPassed(update.window.fontScale === 4.0);
},
);
return () => {
subscription.remove();
};
@@ -31,11 +31,11 @@ const TESTS = [
require('./WebSocketTest'),
require('./AccessibilityManagerTest'),
require('./GlobalEvalWithSourceUrlTest'),
];
].map(mod => mod.default);
TESTS.forEach(test =>
AppRegistry.registerComponent(
test.displayName || test.name || '',
(test as React.ComponentType<any>).displayName || test.name || '',
/* $FlowFixMe[incompatible-type] (>=0.54.0 site=react_native_fb,react_native_
* oss) This comment suppresses an error found when Flow v0.54 was deployed.
* To see the error delete this comment and run Flow. */
@@ -83,7 +83,7 @@ class IntegrationTestsApp extends React.Component<{...}, $FlowFixMe> {
*/
style={styles.row}>
<Text style={styles.testName}>
{test.displayName || test.name}
{(test as React.ComponentType<any>).displayName || test.name}
</Text>
</TouchableOpacity>,
<View style={styles.separator} />,
@@ -201,4 +201,4 @@ const styles = StyleSheet.create({
});
LayoutEventsTest.displayName = 'LayoutEventsTest';
module.exports = LayoutEventsTest;
export default LayoutEventsTest;
@@ -283,4 +283,4 @@ const styles = StyleSheet.create({
});
TimersTest.displayName = 'TimersTest';
module.exports = TimersTest;
export default TimersTest;
@@ -151,4 +151,4 @@ class WebSocketTest extends React.Component<{...}, State> {
WebSocketTest.displayName = 'WebSocketTest';
module.exports = WebSocketTest;
export default WebSocketTest;
-2
View File
@@ -21,8 +21,6 @@ end
prepare_react_native_project!
IN_CI = ENV['CI'] == 'true'
@prefix_path = "../react-native"
linkage = ENV['USE_FRAMEWORKS']
@@ -100,6 +100,11 @@ RCT_EXPORT_MODULE()
return _bridge.uiManager.methodQueue;
}
- (void)setMethodQueue:(dispatch_queue_t)methodQueue
{
// noop
}
RCT_EXPORT_METHOD(verifySnapshot : (RCTResponseSenderBlock)callback)
{
RCTAssert(_controller != nil, @"No snapshot controller configured.");
+4
View File
@@ -63,3 +63,7 @@ See [Running on Device](https://reactnative.dev/docs/running-on-device) for addi
Building the app on both iOS and Android means building the React Native framework from source. This way you're running the latest native and JS code the way you see it in your clone of the github repo.
This is different from apps created using `react-native init` which have a dependency on a specific version of React Native JS and native code, declared in a `package.json` file (and `build.gradle` for Android apps).
## Running tests (iOS)
RNTester provides both integration and unit tests. You can run them all by hitting `Cmd+U` in Xcode. Alternatively, it is possible to run just unit tests or integration tests using the keybinding after selecting the appropriate scheme (either `RNTesterUnitTests` or `RNTesterIntegrationTests`).
@@ -30,6 +30,8 @@ const int64_t LOGGER_TIMEOUT = 10 * NSEC_PER_SEC;
- (void)setUp
{
XCTSkip(@"Skipping RCTLoggingTests since they rely on deprecated RCTBridge functionality.");
NSURL *scriptURL;
if (getenv("CI_USE_PACKAGER")) {
NSString *app = @"IntegrationTests/IntegrationTestsApp";
@@ -40,7 +40,8 @@
#pragma mark - Test harness
- (void)testTheTester_waitOneFrame
// Disabled due to test being based on deprecated RCTBridge
- (void)disabled_testTheTester_waitOneFrame
{
[_runner runTest:_cmd
module:@"IntegrationTestHarnessTest"
@@ -61,17 +62,24 @@
#pragma mark - JS tests
// This list should be kept in sync with IntegrationTestsApp.js
RCT_TEST(IntegrationTestHarnessTest)
// RCT_TEST(IntegrationTestHarnessTest) // Disabled due to test being based on deprecated RCTBridge
// RCT_TEST(TimersTest) // Disabled due to issue introduced in 61346d3
RCT_TEST(AppEventsTest)
// RCT_TEST(AppEventsTest) // Disabled due to test being based on deprecated RCTBridge
// RCT_TEST(ImageCachePolicyTest) // This test never passed.
RCT_TEST(ImageSnapshotTest)
// RCT_TEST(ImageSnapshotTest) // Disabled due to test being based on deprecated RCTBridge
// RCT_TEST(LayoutEventsTest) // Disabled due to flakiness: #8686784
RCT_TEST(SimpleSnapshotTest)
RCT_TEST(SyncMethodTest)
RCT_TEST(PromiseTest)
RCT_TEST_ONLY_WITH_PACKAGER(WebSocketTest) // Requires a WebSocket test server, see scripts/objc-test.sh
RCT_TEST(AccessibilityManagerTest)
RCT_TEST(GlobalEvalWithSourceUrlTest)
// RCT_TEST(SimpleSnapshotTest) // Disabled due to test being based on deprecated RCTBridge
// RCT_TEST(SyncMethodTest) // Disabled due to test being based on deprecated RCTBridge
// RCT_TEST(PromiseTest) // Disabled due to test being based on deprecated RCTBridge
// RCT_TEST_ONLY_WITH_PACKAGER(WebSocketTest) // Disabled due to test being based on deprecated RCTBridge; Requires a
// WebSocket test server, see scripts/objc-test.sh
// Disabled due to TODO(T225745315) causing AccessibilityManager to be unavailable
// and in turn RCTDeviceInfo::_exportedDimensions to fall back to 1.0 font scale,
// failing the test's assertion
// TODO: re-enable this test when TODO(T225745315) is resolved
// RCT_TEST(AccessibilityManagerTest)
// RCT_TEST(GlobalEvalWithSourceUrlTest) // Disabled due to test being based on deprecated RCTBridge
@end
@@ -53,11 +53,6 @@
BlueprintName = "RNTesterIntegrationTests"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "RCTLoggingTests/testLogging">
</Test>
</SkippedTests>
</TestableReference>
</Testables>
</TestAction>
@@ -40,7 +40,7 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
shouldUseLaunchSchemeArgsEnv = "NO">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
@@ -67,11 +67,6 @@
BlueprintName = "RNTesterUnitTests"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
<SkippedTests>
<Test
Identifier = "RCTBundleURLProviderTests">
</Test>
</SkippedTests>
</TestableReference>
<TestableReference
skipped = "NO">
@@ -85,7 +85,8 @@ RCT_EXPORT_METHOD(
[[NSFileManager defaultManager] removeItemAtURL:_bundleURL error:NULL];
}
- (void)testBridgeIsDeallocated
// Disabled due to test being based on deprecated RCTBridge
- (void)disabled_testBridgeIsDeallocated
{
__weak RCTBridge *weakBridge;
@autoreleasepool {
@@ -101,7 +102,8 @@ RCT_EXPORT_METHOD(
XCTAssertNil(weakBridge, @"RCTBridge should have been deallocated");
}
- (void)testModulesAreInvalidated
// Disabled due to test being based on deprecated RCTBridge
- (void)disabled_testModulesAreInvalidated
{
AllocationTestModule *module = [AllocationTestModule new];
@autoreleasepool {
@@ -118,7 +120,8 @@ RCT_EXPORT_METHOD(
XCTAssertFalse(module.isValid, @"AllocationTestModule should have been invalidated by the bridge");
}
- (void)testModulesAreDeallocated
// disabled_Disabled due to test being based on deprecated RCTBridge
- (void)disabled_testModulesAreDeallocated
{
__weak AllocationTestModule *weakModule;
@autoreleasepool {
@@ -156,7 +159,8 @@ RCT_EXPORT_METHOD(
XCTAssertNil(weakMethod, @"RCTModuleMethod should have been deallocated");
}
- (void)testContentViewIsInvalidated
// Disabled due to test being based on deprecated RCTBridge
- (void)disabled_testContentViewIsInvalidated
{
RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL moduleProvider:nil launchOptions:nil];
__weak UIView *rootContentView;
@@ -8,6 +8,9 @@
#import <XCTest/XCTest.h>
#import <React/RCTBlobManager.h>
#import <React/RCTMockDef.h>
RCT_MOCK_REF(RCTBlobManager, dispatch_async);
@interface RCTBlobManagerTests : XCTestCase
@@ -68,8 +71,17 @@
XCTAssertNil([_module resolve:_blobId offset:0 size:_data.length]);
}
static void dispatch_async_mock([[maybe_unused]] dispatch_queue_t queue, dispatch_block_t block)
{
if (block) {
block();
}
}
- (void)testCreateFromParts
{
RCT_MOCK_SET(RCTBlobManager, dispatch_async, dispatch_async_mock);
NSDictionary<NSString *, id> *blobData = @{
@"blobId" : _blobId,
@"offset" : @0,
@@ -96,6 +108,8 @@
NSData *result = [_module resolve:resultId offset:0 size:expectedData.length];
XCTAssertTrue([expectedData isEqualToData:result]);
RCT_MOCK_RESET(RCTBlobManager, dispatch_async);
}
@end
@@ -27,7 +27,7 @@ static NSURL *localhostBundleURL(void)
URLWithString:
[NSString
stringWithFormat:
@"http://localhost:8081/%@.bundle?platform=%@&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&app=com.apple.dt.xctest.tool",
@"http://localhost:8081/%@.bundle?platform=%@&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server&app=com.apple.dt.xctest.tool",
testFile,
RCTPlatformName]];
}
@@ -38,7 +38,7 @@ static NSURL *ipBundleURL(void)
URLWithString:
[NSString
stringWithFormat:
@"http://192.168.1.1:8081/%@.bundle?platform=%@&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&app=com.apple.dt.xctest.tool",
@"http://192.168.1.1:8081/%@.bundle?platform=%@&dev=true&lazy=true&minify=false&inlineSourceMap=false&modulesOnly=false&runModule=true&excludeSource=true&sourcePaths=url-server&app=com.apple.dt.xctest.tool",
testFile,
RCTPlatformName]];
}
@@ -79,6 +79,8 @@ RCT_CUSTOM_VIEW_PROPERTY(customProp, NSString, RCTPropsTestView)
{
[super setUp];
XCTSkip(@"Skipping RCTComponentPropsTests since they rely on deprecated RCTBridge functionality.");
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
_bridge = [[RCTBridge alloc] initWithBundleURL:[bundle URLForResource:@"RNTesterUnitTestsBundle" withExtension:@"js"]
moduleProvider:nil
@@ -120,47 +120,56 @@ static BOOL CGColorsAreEqual(CGColorRef color1, CGColorRef color2)
[UITraitCollection setCurrentTraitCollection:savedTraitCollection];
}
static NSArray<NSNumber *> *UIColorAsNSUInt(UIColor *color)
{
CGFloat red, green, blue, alpha;
[color getRed:&red green:&green blue:&blue alpha:&alpha];
return @[ @(alpha * 255), @(red * 255), @(green * 255), @(blue * 255) ];
}
- (void)testGenerateFallbacks
{
NSDictionary<NSString *, NSNumber *> *semanticColors = @{
NSDictionary<NSString *, NSArray<NSNumber *> *> *semanticColors = @{
// https://developer.apple.com/documentation/uikit/uicolor/ui_element_colors
// Label Colors
@"labelColor" : @(0xFF000000),
@"secondaryLabelColor" : @(0x993c3c43),
@"tertiaryLabelColor" : @(0x4c3c3c43),
@"quaternaryLabelColor" : @(0x2d3c3c43),
@"labelColor" : UIColorAsNSUInt(UIColor.labelColor),
@"secondaryLabelColor" : UIColorAsNSUInt(UIColor.secondaryLabelColor),
@"tertiaryLabelColor" : UIColorAsNSUInt(UIColor.tertiaryLabelColor),
@"quaternaryLabelColor" : UIColorAsNSUInt(UIColor.quaternaryLabelColor),
// Fill Colors
@"systemFillColor" : @(0x33787880),
@"secondarySystemFillColor" : @(0x28787880),
@"tertiarySystemFillColor" : @(0x1e767680),
@"quaternarySystemFillColor" : @(0x14747480),
@"systemFillColor" : UIColorAsNSUInt(UIColor.systemFillColor),
@"secondarySystemFillColor" : UIColorAsNSUInt(UIColor.secondarySystemFillColor),
@"tertiarySystemFillColor" : UIColorAsNSUInt(UIColor.tertiarySystemFillColor),
@"quaternarySystemFillColor" : UIColorAsNSUInt(UIColor.quaternarySystemFillColor),
// Text Colors
@"placeholderTextColor" : @(0x4c3c3c43),
@"placeholderTextColor" : UIColorAsNSUInt(UIColor.placeholderTextColor),
// Standard Content Background Colors
@"systemBackgroundColor" : @(0xFFffffff),
@"secondarySystemBackgroundColor" : @(0xFFf2f2f7),
@"tertiarySystemBackgroundColor" : @(0xFFffffff),
@"systemBackgroundColor" : UIColorAsNSUInt(UIColor.systemBackgroundColor),
@"secondarySystemBackgroundColor" : UIColorAsNSUInt(UIColor.secondarySystemBackgroundColor),
@"tertiarySystemBackgroundColor" : UIColorAsNSUInt(UIColor.tertiarySystemBackgroundColor),
// Grouped Content Background Colors
@"systemGroupedBackgroundColor" : @(0xFFf2f2f7),
@"secondarySystemGroupedBackgroundColor" : @(0xFFffffff),
@"tertiarySystemGroupedBackgroundColor" : @(0xFFf2f2f7),
@"systemGroupedBackgroundColor" : UIColorAsNSUInt(UIColor.systemGroupedBackgroundColor),
@"secondarySystemGroupedBackgroundColor" : UIColorAsNSUInt(UIColor.secondarySystemGroupedBackgroundColor),
@"tertiarySystemGroupedBackgroundColor" : UIColorAsNSUInt(UIColor.tertiarySystemGroupedBackgroundColor),
// Separator Colors
@"separatorColor" : @(0x493c3c43),
@"opaqueSeparatorColor" : @(0xFFc6c6c8),
@"separatorColor" : UIColorAsNSUInt(UIColor.separatorColor),
@"opaqueSeparatorColor" : UIColorAsNSUInt(UIColor.opaqueSeparatorColor),
// Link Color
@"linkColor" : @(0xFF007aff),
@"linkColor" : UIColorAsNSUInt(UIColor.linkColor),
// https://developer.apple.com/documentation/uikit/uicolor/standard_colors
// Adaptable Colors
@"systemBrownColor" : @(0xFFa2845e),
@"systemIndigoColor" : @(0xFF5856d6),
@"systemBrownColor" : UIColorAsNSUInt(UIColor.systemBrownColor),
@"systemIndigoColor" : UIColorAsNSUInt(UIColor.systemIndigoColor),
// Adaptable Gray Colors
@"systemGray2Color" : @(0xFFaeaeb2),
@"systemGray3Color" : @(0xFFc7c7cc),
@"systemGray4Color" : @(0xFFd1d1d6),
@"systemGray5Color" : @(0xFFe5e5ea),
@"systemGray6Color" : @(0xFFf2f2f7),
@"systemGray2Color" : UIColorAsNSUInt(UIColor.systemGray2Color),
@"systemGray3Color" : UIColorAsNSUInt(UIColor.systemGray3Color),
@"systemGray4Color" : UIColorAsNSUInt(UIColor.systemGray4Color),
@"systemGray5Color" : UIColorAsNSUInt(UIColor.systemGray5Color),
@"systemGray6Color" : UIColorAsNSUInt(UIColor.systemGray6Color),
// Clear Color
@"clearColor" : @(0x00000000),
@"clearColor" : UIColorAsNSUInt(UIColor.clearColor),
};
id savedTraitCollection = nil;
@@ -175,12 +184,11 @@ static BOOL CGColorsAreEqual(CGColorRef color1, CGColorRef color2)
UIColor *value = [RCTConvert UIColor:json];
XCTAssertNotNil(value);
NSNumber *fallback = [semanticColors objectForKey:semanticColor];
NSUInteger rgbValue = [fallback unsignedIntegerValue];
NSUInteger alpha1 = ((rgbValue & 0xFF000000) >> 24);
NSUInteger red1 = ((rgbValue & 0x00FF0000) >> 16);
NSUInteger green1 = ((rgbValue & 0x0000FF00) >> 8);
NSUInteger blue1 = ((rgbValue & 0x000000FF) >> 0);
NSArray<NSNumber *> *fallback = [semanticColors objectForKey:semanticColor];
NSUInteger alpha1 = [fallback[0] unsignedIntegerValue];
NSUInteger red1 = [fallback[1] unsignedIntegerValue];
NSUInteger green1 = [fallback[2] unsignedIntegerValue];
NSUInteger blue1 = [fallback[3] unsignedIntegerValue];
CGFloat rgba[4];
RCTGetRGBAColorComponents([value CGColor], rgba);
@@ -31,6 +31,8 @@ typedef void (^RCTDevMenuAlertActionHandler)(UIAlertAction *action);
{
[super setUp];
XCTSkip(@"Skipping RCTDevMenuTests since they rely on deprecated RCTBridge functionality.");
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
_bridge = [[RCTBridge alloc] initWithBundleURL:[bundle URLForResource:@"RNTesterUnitTestsBundle" withExtension:@"js"]
moduleProvider:nil
@@ -11,7 +11,7 @@
#import <React/RCTNetworking.h>
#import <React/RCTUtils.h>
extern BOOL RCTIsGzippedData(NSData *data);
extern BOOL RCTIsGzippedData(NSData *__nullable data);
@interface RCTNetworking (Private)
@@ -52,7 +52,8 @@ extern BOOL RCTIsGzippedData(NSData *data);
XCTAssertEqualObjects(outputString, inputString);
}
- (void)testRequestBodyEncoding
// Disabled due to test being based on deprecated RCTBridge
- (void)disabled_testRequestBodyEncoding
{
NSDictionary *query = @{
@"url" : @"http://example.com",
@@ -29,6 +29,8 @@ RCTDefineImageURLLoader(RCTImageLoaderTestsURLLoader1) RCTDefineImageURLLoader(R
- (void)setUp
{
XCTSkip(@"Skipping RCTImageLoaderTests since they rely on deprecated RCTBridge functionality.");
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
_bundleURL = [bundle URLForResource:@"RNTesterUnitTestsBundle" withExtension:@"js"];
}
@@ -89,6 +89,8 @@ RCT_EXPORT_MODULE()
{
[super setUp];
XCTSkip(@"Skipping RCTModuleInitNotificationRaceTests since they rely on deprecated RCTBridge functionality.");
_notificationObserver = [RCTNotificationObserverModule new];
_bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:nil];
@@ -141,6 +141,8 @@ RCT_EXPORT_MODULE()
{
[super setUp];
XCTSkip(@"Skipping RCTModuleInitTests since they rely on deprecated RCTBridge functionality.");
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moduleDidInit:)
name:RCTDidInitializeModuleNotification
+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() {