diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h index ca6ff6cc0807..d6144bffb56e 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h +++ b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.h @@ -6,22 +6,16 @@ */ #import -#import -#import -#ifdef __cplusplus +@class RCTBridge; +@class RCTRootView; -#import +#ifdef __cplusplus #import @protocol RCTDependencyProvider; -// Forward declaration to decrease compilation coupling -namespace facebook::react { -class JSExecutorFactory; -class RuntimeScheduler; -} // namespace facebook::react RCT_EXTERN NSArray *RCTAppSetupUnstableModulesRequiringMainQueueSetup( id dependencyProvider); @@ -29,9 +23,4 @@ RCT_EXTERN id RCTAppSetupDefaultModuleFromClass( Class moduleClass, id dependencyProvider); -std::unique_ptr RCTAppSetupDefaultJsExecutorFactory( - RCTBridge *bridge, - RCTTurboModuleManager *turboModuleManager, - const std::shared_ptr &runtimeScheduler); - #endif // __cplusplus diff --git a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm index d5aabd85ea1c..513d8ab39680 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTAppSetupUtils.mm @@ -7,10 +7,6 @@ #import "RCTAppSetupUtils.h" -#import -#import -#import - // Turbo Module #import #import @@ -92,11 +88,3 @@ // No custom initializer here. return [moduleClass new]; } - -std::unique_ptr RCTAppSetupDefaultJsExecutorFactory( - RCTBridge *bridge, - RCTTurboModuleManager *turboModuleManager, - const std::shared_ptr &runtimeScheduler) -{ - return nullptr; -} diff --git a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm index d94631a23d82..bf876365c1e6 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTDefaultReactNativeFactoryDelegate.mm @@ -6,6 +6,7 @@ */ #import "RCTDefaultReactNativeFactoryDelegate.h" +#import #import #import "RCTAppSetupUtils.h" #import "RCTDependencyProvider.h" @@ -26,13 +27,6 @@ @implementation RCTDefaultReactNativeFactoryDelegate { @synthesize dependencyProvider; -- (NSURL *_Nullable)sourceURLForBridge:(nonnull RCTBridge *)bridge -{ - [NSException raise:@"RCTBridgeDelegate::sourceURLForBridge not implemented" - format:@"Subclasses must implement a valid sourceURLForBridge method"]; - return nil; -} - - (UIViewController *)createRootViewController { return [UIViewController new]; @@ -54,10 +48,13 @@ - (JSRuntimeFactoryRef)createJSRuntimeFactory #endif } +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" - (void)customizeRootView:(RCTRootView *)rootView { // Override point for customization after application launch. } +#pragma clang diagnostic pop - (RCTColorSpace)defaultColorSpace { @@ -126,11 +123,4 @@ - (Class)getModuleClassFromName:(const char *)name return nullptr; } -- (void)loadSourceForBridge:(RCTBridge *)bridge - onProgress:(RCTSourceLoadProgressBlock)onProgress - onComplete:(RCTSourceLoadBlock)loadCallback -{ - [RCTJavaScriptLoader loadBundleAtURL:[self sourceURLForBridge:bridge] onProgress:onProgress onComplete:loadCallback]; -} - @end diff --git a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm index e4ee18ccb518..deba936037f4 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm +++ b/packages/react-native/Libraries/AppDelegate/RCTReactNativeFactory.mm @@ -295,11 +295,6 @@ - (RCTRootViewFactory *)createRCTRootViewFactory [weakSelf.delegate customizeRootView:(RCTRootView *)rootView]; }; - configuration.sourceURLForBridge = ^NSURL *_Nullable(RCTBridge *_Nonnull bridge) - { - return [weakSelf.delegate bundleURL]; - }; - if ([self.delegate respondsToSelector:@selector(extraModulesForBridge:)]) { configuration.extraModulesForBridge = ^NSArray> *_Nonnull(RCTBridge *_Nonnull bridge) { diff --git a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h index 000963c81e1a..14334a2c102e 100644 --- a/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h +++ b/packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.h @@ -6,6 +6,7 @@ */ #import +#import #import #import #import "RCTJSRuntimeConfiguratorProtocol.h" diff --git a/packages/react-native/React/Base/RCTBridge+Inspector.h b/packages/react-native/React/Base/RCTBridge+Inspector.h deleted file mode 100644 index 66fca692bf05..000000000000 --- a/packages/react-native/React/Base/RCTBridge+Inspector.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#ifdef __cplusplus -#import -#endif - -@interface RCTBridge (Inspector) - -/** - * The HostTarget for this bridge, if one has been created. Exposed for RCTCxxBridge only. - */ -@property (nonatomic, assign, readonly) -#ifdef __cplusplus - facebook::react::jsinspector_modern::HostTarget * -#else - // The inspector infrastructure cannot be used in C or Swift code. - void * -#endif - inspectorTarget; - -@property (nonatomic, readonly, getter=isInspectable) BOOL inspectable; - -@end diff --git a/packages/react-native/React/Base/RCTBridge+Private.h b/packages/react-native/React/Base/RCTBridge+Private.h index f2a8f5a46ca4..bbccde965243 100644 --- a/packages/react-native/React/Base/RCTBridge+Private.h +++ b/packages/react-native/React/Base/RCTBridge+Private.h @@ -16,8 +16,9 @@ RCT_EXTERN void RCTRegisterModule(Class); @interface RCTBridge () -+ (instancetype)currentBridge; -+ (void)setCurrentBridge:(RCTBridge *)bridge; ++ (instancetype)currentBridge __deprecated_msg("This API will be removed along with the legacy architecture."); ++ (void)setCurrentBridge:(RCTBridge *)bridge + __deprecated_msg("This API will be removed along with the legacy architecture."); /** * This method is used to invoke a callback that was registered in the diff --git a/packages/react-native/React/Base/RCTBridge.h b/packages/react-native/React/Base/RCTBridge.h index 38894bea192b..fece38be363b 100644 --- a/packages/react-native/React/Base/RCTBridge.h +++ b/packages/react-native/React/Base/RCTBridge.h @@ -96,45 +96,6 @@ RCT_EXTERN_C_END */ @interface RCTBridge : NSObject -/** - * Creates a new bridge with a custom RCTBridgeDelegate. - * - * All the interaction with the JavaScript context should be done using the bridge - * instance of the RCTBridgeModules. Modules will be automatically instantiated - * using the default constructor, but you can optionally pass in an array of - * pre-initialized module instances if they require additional init parameters - * or configuration. - */ -- (instancetype)initWithDelegate:(id)delegate - launchOptions:(NSDictionary *)launchOptions - __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * DEPRECATED: Use initWithDelegate:launchOptions: instead - * - * The designated initializer. This creates a new bridge on top of the specified - * executor. The bridge should then be used for all subsequent communication - * with the JavaScript code running in the executor. Modules will be automatically - * instantiated using the default constructor, but you can optionally pass in an - * array of pre-initialized module instances if they require additional init - * parameters or configuration. - */ -- (instancetype)initWithBundleURL:(NSURL *)bundleURL - moduleProvider:(RCTBridgeModuleListProvider)block - launchOptions:(NSDictionary *)launchOptions - __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * This method is used to call functions in the JavaScript application context. - * It is primarily intended for use by modules that require two-way communication - * with the JavaScript code. Safe to call from any thread. - */ -- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args; -- (void)enqueueJSCall:(NSString *)module - method:(NSString *)method - args:(NSArray *)args - completion:(dispatch_block_t)completion; - /** * This method registers the file path of an additional JS segment by its ID. * @@ -159,38 +120,22 @@ RCT_EXTERN_C_END * When a NativeModule performs a lookup for a TurboModule, we need to query * the TurboModuleRegistry. */ -- (void)setRCTTurboModuleRegistry:(id)turboModuleRegistry; +- (void)setRCTTurboModuleRegistry:(id)turboModuleRegistry + __deprecated_msg("This API will be removed along with the legacy architecture."); /** * This hook is called by the TurboModule infra with every ObjC module that's created. * It allows the bridge to attach properties to ObjC modules that give those modules * access to Bridge APIs. */ -- (RCTBridgeModuleDecorator *)bridgeModuleDecorator; - -/** - * Convenience method for retrieving all modules conforming to a given protocol. - * Modules will be synchronously instantiated if they haven't already been, - * potentially blocking both the calling thread and main thread for a short time. - */ -- (NSArray *)modulesConformingToProtocol:(Protocol *)protocol; - -/** - * Test if a module has been initialized. Use this prior to calling - * `moduleForClass:` or `moduleForName:` if you do not want to cause the module - * to be instantiated if it hasn't been already. - */ -- (BOOL)moduleIsInitialized:(Class)moduleClass; - -/** - * All registered bridge module classes. - */ -@property (nonatomic, copy, readonly) NSArray *moduleClasses; +- (RCTBridgeModuleDecorator *) + bridgeModuleDecorator __deprecated_msg("This API will be removed along with the legacy architecture."); /** * URL of the script that was loaded into the bridge. */ -@property (nonatomic, strong, readonly) NSURL *bundleURL; +@property (nonatomic, strong, readonly) + NSURL *bundleURL __deprecated_msg("This API will be removed along with the legacy architecture."); /** * The class of the executor currently being used. Changes to this value will @@ -198,11 +143,6 @@ RCT_EXTERN_C_END */ @property (nonatomic, strong) Class executorClass; -/** - * The delegate provided during the bridge initialization - */ -@property (nonatomic, weak, readonly) id delegate; - /** * The launch options that were used to initialize the bridge. */ @@ -223,29 +163,9 @@ RCT_EXTERN_C_END */ @property (nonatomic, readonly, strong) RCTPerformanceLogger *performanceLogger; -/** - * Reload the bundle and reset executor & modules. Safe to call from any thread. - */ -- (void)reload __deprecated_msg("Use RCTReloadCommand instead"); - -/** - * Reload the bundle and reset executor & modules. Safe to call from any thread. - */ -- (void)reloadWithReason:(NSString *)reason __deprecated_msg("Use RCTReloadCommand instead"); - /** * Handle notifications for a fast refresh. Safe to call from any thread. */ - (void)onFastRefresh; -/** - * Inform the bridge, and anything subscribing to it, that it should reload. - */ -- (void)requestReload __deprecated_msg("Use RCTReloadCommand instead"); - -/** - * Says whether bridge has started receiving calls from JavaScript. - */ -- (BOOL)isBatchActive; - @end diff --git a/packages/react-native/React/Base/RCTBridge.mm b/packages/react-native/React/Base/RCTBridge.mm index 44b3cdcd2e7f..53d681c941d5 100644 --- a/packages/react-native/React/Base/RCTBridge.mm +++ b/packages/react-native/React/Base/RCTBridge.mm @@ -6,7 +6,6 @@ */ #import "RCTBridge.h" -#import "RCTBridge+Inspector.h" #import "RCTBridge+Private.h" #import @@ -24,7 +23,6 @@ #import "RCTInspectorUtils.h" #import "RCTJSThread.h" #import "RCTLog.h" -#import "RCTModuleData.h" #import "RCTPausedInDebuggerOverlayController.h" #import "RCTPerformanceLogger.h" #import "RCTReloadCommand.h" @@ -241,29 +239,6 @@ void RCTUIManagerSetDispatchAccessibilityManagerInitOntoMain(BOOL enabled) } @implementation RCTBridge -- (instancetype)initWithDelegate:(id)delegate launchOptions:(NSDictionary *)launchOptions -{ - return self; -} - -- (instancetype)initWithBundleURL:(NSURL *)bundleURL - moduleProvider:(__strong RCTBridgeModuleListProvider)block - launchOptions:(NSDictionary *)launchOptions -{ - return self; -} - -- (void)enqueueJSCall:(NSString *)moduleDotMethod args:(NSArray *)args -{ -} - -- (void)enqueueJSCall:(NSString *)module - method:(NSString *)method - args:(NSArray *)args - completion:(__strong dispatch_block_t)completion -{ -} - - (void)registerSegmentWithId:(NSUInteger)segmentId path:(NSString *)path { } @@ -292,37 +267,10 @@ - (RCTBridgeModuleDecorator *)bridgeModuleDecorator return nil; } -- (NSArray *)modulesConformingToProtocol:(Protocol *)protocol -{ - return @[]; -} - -- (BOOL)moduleIsInitialized:(Class)moduleClass -{ - return NO; -} - -- (void)reload __attribute__((deprecated("Use RCTReloadCommand instead"))) -{ -} - -- (void)reloadWithReason:(NSString *)reason __attribute__((deprecated("Use RCTReloadCommand instead"))) -{ -} - - (void)onFastRefresh { } -- (void)requestReload __attribute__((deprecated("Use RCTReloadCommand instead"))) -{ -} - -- (BOOL)isBatchActive -{ - return NO; -} - - (void)enqueueCallback:(NSNumber *)cbID args:(NSArray *)args { } diff --git a/packages/react-native/React/Base/RCTBridgeConstants.h b/packages/react-native/React/Base/RCTBridgeConstants.h index 13a1d0e97ef3..ea560264b9ba 100644 --- a/packages/react-native/React/Base/RCTBridgeConstants.h +++ b/packages/react-native/React/Base/RCTBridgeConstants.h @@ -15,57 +15,9 @@ * DEPRECATED - Use RCTReloadCommand instead. This notification fires just before the bridge starts * processing a request to reload. */ -RCT_EXTERN NSString *const RCTBridgeWillReloadNotification; +RCT_EXTERN NSString *const RCTBridgeWillReloadNotification __deprecated_msg("Use RCTReloadCommand instead."); /** * This notification fires whenever a fast refresh happens. */ RCT_EXTERN NSString *const RCTBridgeFastRefreshNotification; - -/** - * This notification fires just before the bridge begins downloading a script - * from the packager. - */ -RCT_EXTERN NSString *const RCTBridgeWillDownloadScriptNotification; - -/** - * This notification fires just after the bridge finishes downloading a script - * from the packager. - */ -RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotification; - -/** - * This notification fires right after the bridge is about to invalidate NativeModule - * instances during teardown. Handle this notification to perform additional invalidation. - */ -RCT_EXTERN NSString *const RCTBridgeWillInvalidateModulesNotification; - -/** - * This notification fires right after the bridge finishes invalidating NativeModule - * instances during teardown. Handle this notification to perform additional invalidation. - */ -RCT_EXTERN NSString *const RCTBridgeDidInvalidateModulesNotification; - -/** - * This notification fires right before the bridge starting invalidation process. - * Handle this notification to perform additional invalidation. - * The notification can be issued on any thread. - */ -RCT_EXTERN NSString *const RCTBridgeWillBeInvalidatedNotification; - -/** - * Key for the RCTSource object in the RCTBridgeDidDownloadScriptNotification - * userInfo dictionary. - */ -RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationSourceKey; - -/** - * Key for the reload reason in the RCTBridgeWillReloadNotification userInfo dictionary. - */ -RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationReasonKey; - -/** - * Key for the bridge description (NSString_ in the - * RCTBridgeDidDownloadScriptNotification userInfo dictionary. - */ -RCT_EXTERN NSString *const RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey; diff --git a/packages/react-native/React/Base/RCTBridgeConstants.m b/packages/react-native/React/Base/RCTBridgeConstants.m index 18080e0a2042..5f23544d11ac 100644 --- a/packages/react-native/React/Base/RCTBridgeConstants.m +++ b/packages/react-native/React/Base/RCTBridgeConstants.m @@ -9,10 +9,3 @@ NSString *const RCTBridgeWillReloadNotification = @"RCTBridgeWillReloadNotification"; NSString *const RCTBridgeFastRefreshNotification = @"RCTBridgeFastRefreshNotification"; -NSString *const RCTBridgeWillDownloadScriptNotification = @"RCTBridgeWillDownloadScriptNotification"; -NSString *const RCTBridgeDidDownloadScriptNotification = @"RCTBridgeDidDownloadScriptNotification"; -NSString *const RCTBridgeWillInvalidateModulesNotification = @"RCTBridgeWillInvalidateModulesNotification"; -NSString *const RCTBridgeDidInvalidateModulesNotification = @"RCTBridgeDidInvalidateModulesNotification"; -NSString *const RCTBridgeWillBeInvalidatedNotification = @"RCTBridgeWillBeInvalidatedNotification"; -NSString *const RCTBridgeDidDownloadScriptNotificationSourceKey = @"source"; -NSString *const RCTBridgeDidDownloadScriptNotificationBridgeDescriptionKey = @"bridgeDescription"; diff --git a/packages/react-native/React/Base/RCTBridgeDelegate.h b/packages/react-native/React/Base/RCTBridgeDelegate.h index 9e5306f8fc7e..d5293d9f9db8 100644 --- a/packages/react-native/React/Base/RCTBridgeDelegate.h +++ b/packages/react-native/React/Base/RCTBridgeDelegate.h @@ -13,17 +13,6 @@ NS_ASSUME_NONNULL_BEGIN @protocol RCTBridgeDelegate -#ifndef RCT_REMOVE_LEGACY_ARCH - -/** - * The location of the JavaScript source file. When running from the packager - * this should be an absolute URL, e.g. `http://localhost:8081/index.ios.bundle`. - * When running from a locally bundled JS file, this should be a `file://` url - * pointing to a path inside the app resources, e.g. `file://.../main.jsbundle`. - */ -- (NSURL *__nullable)sourceURLForBridge:(RCTBridge *)bridge - __deprecated_msg("This API will be removed along with the legacy architecture."); -#endif @end NS_ASSUME_NONNULL_END diff --git a/packages/react-native/React/Base/RCTBridgeProxy.mm b/packages/react-native/React/Base/RCTBridgeProxy.mm index 105683fbc4ad..6a79668c4628 100644 --- a/packages/react-native/React/Base/RCTBridgeProxy.mm +++ b/packages/react-native/React/Base/RCTBridgeProxy.mm @@ -335,15 +335,6 @@ - (void)_immediatelyCallTimer:(NSNumber *)timer [self logWarning:@"This method is not supported. Nooping." cmd:_cmd]; } -/** - * RCTBridge (Inspector) - */ -- (BOOL)inspectable -{ - [self logWarning:@"This method is not supported. Returning NO." cmd:_cmd]; - return NO; -} - /** * RCTBridge (RCTUIManager) */ diff --git a/packages/react-native/React/Base/RCTModuleData.h b/packages/react-native/React/Base/RCTModuleData.h deleted file mode 100644 index 812991e4d26a..000000000000 --- a/packages/react-native/React/Base/RCTModuleData.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@protocol RCTBridgeMethod; -@protocol RCTBridgeModule; -@class RCTBridge; -@class RCTModuleData; -@class RCTModuleRegistry; -@class RCTViewRegistry; -@class RCTBundleManager; -@class RCTCallableJSModules; -@class RCTCallInvoker; - -typedef id (^RCTBridgeModuleProvider)(void); - -@protocol RCTModuleDataCallInvokerProvider - -- (RCTCallInvoker *)callInvokerForModuleData:(RCTModuleData *)moduleData; - -@end - -@interface RCTModuleData : NSObject - -- (instancetype)initWithModuleClass:(Class)moduleClass - bridge:(RCTBridge *)bridge - moduleRegistry:(RCTModuleRegistry *)moduleRegistry - viewRegistry_DEPRECATED:(RCTViewRegistry *)viewRegistry_DEPRECATED - bundleManager:(RCTBundleManager *)bundleManager - callableJSModules:(RCTCallableJSModules *)callableJSModules NS_DESIGNATED_INITIALIZER - __deprecated_msg("This API will be removed along with the legacy architecture."); - -- (instancetype)initWithModuleInstance:(id)instance - bridge:(RCTBridge *)bridge - moduleRegistry:(RCTModuleRegistry *)moduleRegistry - viewRegistry_DEPRECATED:(RCTViewRegistry *)viewRegistry_DEPRECATED - bundleManager:(RCTBundleManager *)bundleManager - callableJSModules:(RCTCallableJSModules *)callableJSModules NS_DESIGNATED_INITIALIZER - __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Calls `constantsToExport` on the module and stores the result. Note that - * this will init the module if it has not already been created. This method - * can be called on any thread, but may block the main thread briefly if the - * module implements `constantsToExport`. - */ -- (void)gatherConstants __deprecated_msg("This API will be removed along with the legacy architecture."); - -@property (nonatomic, strong, readonly) - Class moduleClass __deprecated_msg("This API will be removed along with the legacy architecture."); -@property (nonatomic, copy, readonly) - NSString *name __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Returns the module methods. Note that this will gather the methods the first - * time it is called and then memoize the results. - */ -@property (nonatomic, copy, readonly) NSArray> *methods __deprecated_msg( - "This API will be removed along with the legacy architecture."); - -/** - * Returns a map of the module methods. Note that this will gather the methods the first - * time it is called and then memoize the results. - */ -@property (nonatomic, copy, readonly) NSDictionary> *methodsByName __deprecated_msg( - "This API will be removed along with the legacy architecture."); - -/** - * Returns the module's constants, if it exports any - */ -@property (nonatomic, copy, readonly) NSDictionary *exportedConstants __deprecated_msg( - "This API will be removed along with the legacy architecture."); - -/** - * Returns YES if module instance has already been initialized; NO otherwise. - */ -@property (nonatomic, assign, readonly) - BOOL hasInstance __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Returns YES if module instance must be created on the main thread. - */ -@property (nonatomic, assign) - BOOL requiresMainQueueSetup __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Returns YES if module has constants to export. - */ -@property (nonatomic, assign, readonly) - BOOL hasConstantsToExport __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Returns the current module instance. Note that this will init the instance - * if it has not already been created. To check if the module instance exists - * without causing it to be created, use `hasInstance` instead. - */ -@property (nonatomic, strong, readwrite) id instance __deprecated_msg( - "This API will be removed along with the legacy architecture."); - -/** - * Returns the module method dispatch queue. Note that this will init both the - * queue and the module itself if they have not already been created. - */ -@property (nonatomic, strong, readonly) - dispatch_queue_t methodQueue __deprecated_msg("This API will be removed along with the legacy architecture."); - -/** - * Whether the receiver has a valid `instance` which implements -batchDidComplete. - */ -@property (nonatomic, assign, readonly) - BOOL implementsBatchDidComplete __deprecated_msg("This API will be removed along with the legacy architecture."); - -@property (nonatomic, weak, readwrite) id callInvokerProvider __deprecated_msg( - "This API will be removed along with the legacy architecture."); - -@end diff --git a/packages/react-native/React/Base/RCTModuleData.mm b/packages/react-native/React/Base/RCTModuleData.mm deleted file mode 100644 index e52d9008deb8..000000000000 --- a/packages/react-native/React/Base/RCTModuleData.mm +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTModuleData.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-designated-initializers" - -@implementation RCTModuleData - -- (instancetype)initWithModuleClass:(Class)moduleClass - bridge:(RCTBridge *)bridge - moduleRegistry:(RCTModuleRegistry *)moduleRegistry - viewRegistry_DEPRECATED:(RCTViewRegistry *)viewRegistry_DEPRECATED - bundleManager:(RCTBundleManager *)bundleManager - callableJSModules:(RCTCallableJSModules *)callableJSModules -{ - return self; -} - -- (instancetype)initWithModuleInstance:(id)instance - bridge:(RCTBridge *)bridge - moduleRegistry:(RCTModuleRegistry *)moduleRegistry - viewRegistry_DEPRECATED:(RCTViewRegistry *)viewRegistry_DEPRECATED - bundleManager:(RCTBundleManager *)bundleManager - callableJSModules:(RCTCallableJSModules *)callableJSModules -{ - return self; -} - -- (void)gatherConstants -{ -} - -- (void)invalidate -{ -} - -@end diff --git a/packages/react-native/React/CoreModules/RCTDevSettings.mm b/packages/react-native/React/CoreModules/RCTDevSettings.mm index 89a7b0c793e6..e6999634d58a 100644 --- a/packages/react-native/React/CoreModules/RCTDevSettings.mm +++ b/packages/react-native/React/CoreModules/RCTDevSettings.mm @@ -10,7 +10,6 @@ #import #import -#import #import #import #import diff --git a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm index 1761214fc3bd..579fb6675226 100644 --- a/packages/react-native/React/CoreModules/RCTDeviceInfo.mm +++ b/packages/react-native/React/CoreModules/RCTDeviceInfo.mm @@ -116,16 +116,6 @@ - (void)initialize object:nil]; #endif - // TODO T175901725 - Registering the RCTDeviceInfo module to the notification is a short-term fix to unblock 0.73 - // The actual behavior should be that the module is properly registered in the TurboModule/Bridge infrastructure - // and the infrastructure imperatively invoke the `invalidate` method, rather than listening to a notification. - // This is a temporary workaround until we can investigate the issue better as there might be other modules in a - // similar situation. - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(invalidate) - name:RCTBridgeWillInvalidateModulesNotification - object:nil]; - [self invalidateCachedConstants]; } @@ -160,8 +150,6 @@ - (void)_cleanupObservers [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTUserInterfaceStyleDidChangeNotification object:nil]; - [[NSNotificationCenter defaultCenter] removeObserver:self name:RCTBridgeWillInvalidateModulesNotification object:nil]; - [_applicationWindow removeObserver:self forKeyPath:kFrameKeyPath]; #if TARGET_OS_IOS diff --git a/packages/react-native/React/CxxModule/RCTCxxUtils.h b/packages/react-native/React/CxxModule/RCTCxxUtils.h index 1235c181de0a..dc4c25dec740 100644 --- a/packages/react-native/React/CxxModule/RCTCxxUtils.h +++ b/packages/react-native/React/CxxModule/RCTCxxUtils.h @@ -11,7 +11,6 @@ #import @class RCTBridge; -@class RCTModuleData; namespace facebook::react { diff --git a/packages/react-native/React/CxxModule/RCTCxxUtils.mm b/packages/react-native/React/CxxModule/RCTCxxUtils.mm index e3009bd5f852..386ac5fd1697 100644 --- a/packages/react-native/React/CxxModule/RCTCxxUtils.mm +++ b/packages/react-native/React/CxxModule/RCTCxxUtils.mm @@ -7,7 +7,6 @@ #import "RCTCxxUtils.h" -#import #import #import #import diff --git a/packages/react-native/React/Fabric/Surface/RCTFabricSurface.h b/packages/react-native/React/Fabric/Surface/RCTFabricSurface.h index 1958c010540f..fd00787cf94f 100644 --- a/packages/react-native/React/Fabric/Surface/RCTFabricSurface.h +++ b/packages/react-native/React/Fabric/Surface/RCTFabricSurface.h @@ -10,7 +10,6 @@ NS_ASSUME_NONNULL_BEGIN -@class RCTBridge; @class RCTSurfaceView; @class RCTSurfacePresenter; @@ -118,15 +117,4 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface RCTFabricSurface (Deprecated) - -/** - * Deprecated. Use `initWithSurfacePresenter:moduleName:initialProperties` instead. - */ -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties; - -@end - NS_ASSUME_NONNULL_END diff --git a/packages/react-native/React/Fabric/Surface/RCTFabricSurface.mm b/packages/react-native/React/Fabric/Surface/RCTFabricSurface.mm index b0bdfed944eb..77452c49febb 100644 --- a/packages/react-native/React/Fabric/Surface/RCTFabricSurface.mm +++ b/packages/react-native/React/Fabric/Surface/RCTFabricSurface.mm @@ -300,17 +300,6 @@ - (void)handleContentSizeCategoryDidChangeNotification:(NSNotification *)notific return *_surfaceHandler; } -#pragma mark - Deprecated - -- (instancetype)initWithBridge:(RCTBridge *)bridge - moduleName:(NSString *)moduleName - initialProperties:(NSDictionary *)initialProperties -{ - return [self initWithSurfacePresenter:bridge.surfacePresenter - moduleName:moduleName - initialProperties:initialProperties]; -} - - (NSNumber *)rootViewTag { return @(_surfaceHandler->getSurfaceId()); diff --git a/packages/react-native/React/Modules/RCTSurfacePresenterStub.h b/packages/react-native/React/Modules/RCTSurfacePresenterStub.h index aea607083a05..fa17741f1143 100644 --- a/packages/react-native/React/Modules/RCTSurfacePresenterStub.h +++ b/packages/react-native/React/Modules/RCTSurfacePresenterStub.h @@ -38,13 +38,6 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface RCTBridge (RCTSurfacePresenterStub) - -- (id)surfacePresenter; -- (void)setSurfacePresenter:(id)presenter; - -@end - @interface RCTBridgeProxy (RCTSurfacePresenterStub) - (id)surfacePresenter; diff --git a/packages/react-native/React/Modules/RCTUIManager.mm b/packages/react-native/React/Modules/RCTUIManager.mm index 3e7eba4aae4a..1ab3804b0398 100644 --- a/packages/react-native/React/Modules/RCTUIManager.mm +++ b/packages/react-native/React/Modules/RCTUIManager.mm @@ -22,7 +22,6 @@ #import "RCTLayoutAnimation.h" #import "RCTLayoutAnimationGroup.h" #import "RCTLog.h" -#import "RCTModuleData.h" #import "RCTModuleMethod.h" #import "RCTScrollableProtocol.h" #import "RCTShadowView.h" diff --git a/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm b/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm index 6d5c8ec8410f..a467d5802d40 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm +++ b/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/LegacyViewManagerInteropComponentDescriptor.mm @@ -15,7 +15,6 @@ #include #include #include -#include #import #include #include diff --git a/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm b/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm index 1bfe6677c629..e6251007b4e9 100644 --- a/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm +++ b/packages/react-native/ReactCommon/react/renderer/components/legacyviewmanagerinterop/platform/ios/react/renderer/components/legacyviewmanagerinterop/RCTLegacyViewManagerInteropCoordinator.mm @@ -14,7 +14,6 @@ #include #include #include -#include #include #include #include diff --git a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm index 40480593c587..b55efded9542 100644 --- a/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm +++ b/packages/react-native/ReactCommon/react/runtime/platform/ios/ReactCommon/RCTInstance.mm @@ -12,8 +12,6 @@ #import #import #import -#import -#import #import #import #import @@ -29,7 +27,6 @@ #import #import #import -#import #import #import #import @@ -329,7 +326,6 @@ - (void)_start bridgeProxy.jsCallInvoker = jsCallInvoker; bridgeProxy.performanceLogger = _performanceLogger; _bridgeProxy = bridgeProxy; - [RCTBridge setCurrentBridge:(RCTBridge *)bridgeProxy]; // Set up TurboModules _turboModuleManager = [[RCTTurboModuleManager alloc] initWithBridgeProxy:bridgeProxy diff --git a/packages/rn-tester/IntegrationTests/AppEventsTest.js b/packages/rn-tester/IntegrationTests/AppEventsTest.js deleted file mode 100644 index 61cae363bff0..000000000000 --- a/packages/rn-tester/IntegrationTests/AppEventsTest.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -import deepEquals from './RNTesterDeepEquals'; -import * as React from 'react'; -import {useEffect, useState} from 'react'; -import { - NativeAppEventEmitter, - NativeModules, - StyleSheet, - Text, - View, -} from 'react-native'; - -const {TestModule} = NativeModules; - -const TEST_PAYLOAD = {foo: 'bar'}; - -type AppEvent = { - data: any, - ts: number, -}; - -type State = { - sent: 'none' | AppEvent, - received: 'none' | AppEvent, - elapsed?: string, -}; - -function AppEventsTest(): React.Node { - const [state, setState] = useState({ - sent: 'none', - received: 'none', - }); - - useEffect(() => { - const receiveEvent = (event: any) => { - if (!deepEquals(event.data, TEST_PAYLOAD)) { - throw new Error('Received wrong event: ' + JSON.stringify(event)); - } - const elapsed = Date.now() - event.ts + 'ms'; - setState(prevState => ({ - ...prevState, - received: event, - elapsed, - })); - TestModule.markTestCompleted(); - }; - - const listener = NativeAppEventEmitter.addListener( - 'testEvent', - receiveEvent, - ); - - const event = {data: TEST_PAYLOAD, ts: Date.now()}; - TestModule.sendAppEvent('testEvent', event); - setState(prevState => ({...prevState, sent: event})); - - return () => { - listener.remove(); - }; - }, []); - - return ( - - {JSON.stringify(state, null, ' ')} - - ); -} - -const styles = StyleSheet.create({ - container: { - margin: 40, - }, -}); - -export default AppEventsTest; diff --git a/packages/rn-tester/IntegrationTests/GlobalEvalWithSourceUrlTest.js b/packages/rn-tester/IntegrationTests/GlobalEvalWithSourceUrlTest.js deleted file mode 100644 index ac5307abbc7b..000000000000 --- a/packages/rn-tester/IntegrationTests/GlobalEvalWithSourceUrlTest.js +++ /dev/null @@ -1,96 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import * as React from 'react'; -import {useEffect} from 'react'; -import {NativeModules, View} from 'react-native'; - -const {TestModule} = NativeModules; - -type ErrorWithEngine = Error & - interface { - jsEngine?: string, - }; - -function getFirstStackFrameFile(stack?: string): ?string { - if (stack == null) { - return null; - } - for (const line of stack.split('\n')) { - const match = line.match(/(?:\(|@|\s)(https?:\/\/.*?):\d+:\d+\)?$/); - if (match != null) { - return match[1]; - } - } - return null; -} - -function GlobalEvalWithSourceUrlTest(): React.Node { - useEffect(() => { - if (typeof global.globalEvalWithSourceUrl !== 'function') { - throw new Error( - 'Expected to find globalEvalWithSourceUrl function on global object but found ' + - typeof global.globalEvalWithSourceUrl, - ); - } - const value = global.globalEvalWithSourceUrl('42'); - if (value !== 42) { - throw new Error( - 'Expected globalEvalWithSourceUrl(expression) to return a value', - ); - } - let syntaxError: ?ErrorWithEngine; - try { - global.globalEvalWithSourceUrl('{'); - } catch (e) { - syntaxError = e; - } - if (!syntaxError) { - throw new Error( - 'Expected globalEvalWithSourceUrl to throw on a syntax error', - ); - } - // Hermes throws an Error instead of a SyntaxError - // https://github.com/facebook/hermes/issues/400 - if ( - syntaxError.jsEngine !== 'hermes' && - !(syntaxError instanceof SyntaxError) - ) { - throw new Error( - 'Expected globalEvalWithSourceUrl to throw SyntaxError on a syntax error', - ); - } - const url = 'http://example.com/foo.js'; - let error; - try { - global.globalEvalWithSourceUrl('throw new Error()', url); - } catch (e) { - error = e; - } - if (!error) { - throw new Error( - 'Expected globalEvalWithSourceUrl to throw an Error object', - ); - } - const firstStackFrameFile = getFirstStackFrameFile(error.stack); - if (firstStackFrameFile !== url) { - throw new Error( - `Expected first eval stack frame to be in ${url} but found ${String(firstStackFrameFile)}`, - ); - } - TestModule.markTestCompleted(); - }, []); - - return ; -} - -export default GlobalEvalWithSourceUrlTest; diff --git a/packages/rn-tester/IntegrationTests/ImageCachePolicyTest.js b/packages/rn-tester/IntegrationTests/ImageCachePolicyTest.js deleted file mode 100644 index bfbfee8637e3..000000000000 --- a/packages/rn-tester/IntegrationTests/ImageCachePolicyTest.js +++ /dev/null @@ -1,108 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import type {ImageURISource} from 'react-native'; - -import * as React from 'react'; -import {useEffect, useState} from 'react'; -import {Image, NativeModules, StyleSheet, Text, View} from 'react-native'; - -const {TestModule} = NativeModules; - -/* - * The reload and force-cache tests don't actually verify that the complete functionality. - * - * reload: Should have the server set a long cache header, then swap the image on next load - * with the test comparing the old image to the new image and making sure they are different. - * - * force-cache: Should do the above but set a no-cache header. The test should compare the first - * image with the new one and make sure they are the same. - */ - -const TESTS = ['only-if-cached', 'default', 'reload', 'force-cache'] as const; - -function ImageCachePolicyTest(): React.Node { - const [state, setState] = useState<{[string]: ?boolean}>({ - default: undefined, - 'force-cache': undefined, - 'only-if-cached': undefined, - reload: undefined, - }); - - const testComplete = ( - name: NonNullable, - pass: boolean, - ) => { - setState(prevState => ({ - ...prevState, - [name]: pass, - })); - }; - - useEffect(() => { - const results = TESTS.map(key => state[key]); - - if (!results.includes(undefined)) { - const result = results.reduce((x, y) => (x === y) === true, true); - TestModule.markTestPassed(result); - } - }, [state]); - - return ( - - Hello - testComplete('only-if-cached', false)} - onError={() => testComplete('only-if-cached', true)} - style={styles.base} - /> - testComplete('default', true)} - onError={() => testComplete('default', false)} - style={styles.base} - /> - testComplete('reload', true)} - onError={() => testComplete('reload', false)} - style={styles.base} - /> - testComplete('force-cache', true)} - onError={() => testComplete('force-cache', false)} - style={styles.base} - /> - - ); -} - -const getImageSource = (cache: ImageURISource['cache']) => ({ - cache, - uri: - 'https://raw.githubusercontent.com/facebook/react-native/HEAD/Libraries/NewAppScreen/components/logo.png?cacheBust=notinCache' + - Date.now(), -}); - -const styles = StyleSheet.create({ - base: { - height: 100, - width: 100, - }, - container: { - flex: 1, - }, -}); - -export default ImageCachePolicyTest; diff --git a/packages/rn-tester/IntegrationTests/ImageSnapshotTest.js b/packages/rn-tester/IntegrationTests/ImageSnapshotTest.js deleted file mode 100644 index e25bc8f1e92b..000000000000 --- a/packages/rn-tester/IntegrationTests/ImageSnapshotTest.js +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import * as React from 'react'; -import {useEffect} from 'react'; -import {Image, NativeModules} from 'react-native'; - -const {TestModule} = NativeModules; - -function ImageSnapshotTest(): React.Node { - useEffect(() => { - if (!TestModule.verifySnapshot) { - throw new Error('TestModule.verifySnapshot not defined.'); - } - }, []); - - const done = (success: boolean) => { - TestModule.markTestPassed(success); - }; - - return ( - TestModule.verifySnapshot(done)} - /> - ); -} - -export default ImageSnapshotTest; diff --git a/packages/rn-tester/IntegrationTests/IntegrationTestHarnessTest.js b/packages/rn-tester/IntegrationTests/IntegrationTestHarnessTest.js deleted file mode 100644 index fdf95ceced4d..000000000000 --- a/packages/rn-tester/IntegrationTests/IntegrationTestHarnessTest.js +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -import * as React from 'react'; -import {useEffect, useState} from 'react'; -import {NativeModules, StyleSheet, Text, View} from 'react-native'; - -const {TestModule} = NativeModules; - -type Props = Readonly<{ - shouldThrow?: boolean, - waitOneFrame?: boolean, -}>; - -function IntegrationTestHarnessTest(props: Props): React.Node { - const [done, setDone] = useState(false); - - useEffect(() => { - const runTest = () => { - if (props.shouldThrow) { - throw new Error('Throwing error because shouldThrow'); - } - if (!TestModule) { - throw new Error('RCTTestModule is not registered.'); - } else if (!TestModule.markTestCompleted) { - throw new Error('RCTTestModule.markTestCompleted not defined.'); - } - setDone(true); - TestModule.markTestCompleted(); - }; - - if (props.waitOneFrame) { - requestAnimationFrame(runTest); - } else { - runTest(); - } - }, [props.shouldThrow, props.waitOneFrame]); - - return ( - - - {IntegrationTestHarnessTest.name + ': '} - {done ? 'Done' : 'Testing...'} - - - ); -} - -const styles = StyleSheet.create({ - container: { - backgroundColor: 'white', - padding: 40, - }, -}); - -export default IntegrationTestHarnessTest; diff --git a/packages/rn-tester/IntegrationTests/IntegrationTestsApp.js b/packages/rn-tester/IntegrationTests/IntegrationTestsApp.js deleted file mode 100644 index 1187023ab559..000000000000 --- a/packages/rn-tester/IntegrationTests/IntegrationTestsApp.js +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -require('react-native/setup-env'); - -const React = require('react'); -const ReactNative = require('react-native'); - -const {AppRegistry, ScrollView, StyleSheet, Text, TouchableOpacity, View} = - ReactNative; - -// Keep this list in sync with RNTesterIntegrationTests.m -const TESTS = [ - require('./IntegrationTestHarnessTest'), - require('./TimersTest'), - require('./LayoutEventsTest'), - require('./AppEventsTest'), - require('./SimpleSnapshotTest'), - require('./ImageCachePolicyTest'), - require('./ImageSnapshotTest'), - require('./PromiseTest'), - require('./SyncMethodTest'), - require('./WebSocketTest'), - require('./GlobalEvalWithSourceUrlTest'), -].map(mod => mod.default); - -TESTS.forEach(test => - AppRegistry.registerComponent( - (test as React.ComponentType).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. */ - () => test, - ), -); - -// Modules required for integration tests -require('./LoggingTestModule'); - -type Test = any; - -class IntegrationTestsApp extends React.Component<{...}, $FlowFixMe> { - state: {test: ?Test} = { - test: null as ?Test, - }; - - render(): React.Node { - if (this.state.test) { - return ( - - {/* $FlowFixMe[type-as-value] (>=0.53.0 site=react_native_fb,react_ - * native_oss) This comment suppresses an error when upgrading - * Flow's support for React. To see the error delete this comment - * and run Flow. */} - - - ); - } - return ( - - - Click on a test to run it in this shell for easier debugging and - development. Run all tests in the testing environment with cmd+U in - Xcode. - - - - {TESTS.map(test => [ - this.setState({test})} - /* $FlowFixMe[incompatible-type] (>=0.115.0 site=react_native_fb) - * This comment suppresses an error found when Flow v0.115 was - * deployed. To see the error, delete this comment and run Flow. - */ - style={styles.row}> - - {(test as React.ComponentType).displayName || test.name} - - , - , - ])} - - - ); - } -} - -const styles = StyleSheet.create({ - container: { - backgroundColor: 'white', - marginTop: 40, - margin: 15, - }, - row: { - padding: 10, - }, - testName: { - fontWeight: '500', - }, - separator: { - height: 1, - backgroundColor: '#bbbbbb', - }, -}); - -AppRegistry.registerComponent('IntegrationTestsApp', () => IntegrationTestsApp); diff --git a/packages/rn-tester/IntegrationTests/LayoutEventsTest.js b/packages/rn-tester/IntegrationTests/LayoutEventsTest.js deleted file mode 100644 index e52f3da36904..000000000000 --- a/packages/rn-tester/IntegrationTests/LayoutEventsTest.js +++ /dev/null @@ -1,203 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import type {LayoutChangeEvent, LayoutRectangle} from 'react-native'; - -const deepEquals = require('./RNTesterDeepEquals').default; -const React = require('react'); -const ReactNative = require('react-native'); - -const {Image, LayoutAnimation, StyleSheet, Text, View} = ReactNative; -const {TestModule} = ReactNative.NativeModules; -type ViewStyleProp = NonNullable>; -function debug(...args: Array) { - // console.log.apply(null, arguments); -} - -type Props = Readonly<{}>; - -type State = { - didAnimation: boolean, - extraText?: string, - imageLayout?: LayoutRectangle, - textLayout?: LayoutRectangle, - viewLayout?: LayoutRectangle, - viewStyle?: ViewStyleProp, - containerStyle?: ViewStyleProp, - ... -}; - -class LayoutEventsTest extends React.Component { - _view: ?React.ElementRef; - _img: ?React.ElementRef; - _txt: ?React.ElementRef; - - state: State = { - didAnimation: false, - }; - - animateViewLayout() { - debug('animateViewLayout invoked'); - LayoutAnimation.configureNext(LayoutAnimation.Presets.spring, () => { - debug('animateViewLayout done'); - this.checkLayout(this.addWrapText); - }); - this.setState({viewStyle: {margin: 60}}); - } - - addWrapText: () => void = () => { - debug('addWrapText invoked'); - this.setState( - {extraText: ' And a bunch more text to wrap around a few lines.'}, - () => this.checkLayout(this.changeContainer), - ); - }; - - changeContainer: () => void = () => { - debug('changeContainer invoked'); - this.setState({containerStyle: {width: 280}}, () => - this.checkLayout(TestModule.markTestCompleted), - ); - }; - - checkLayout: (next?: ?() => void) => void = (next?: ?() => void) => { - const view = this._view; - const txt = this._txt; - const img = this._img; - - if (view == null || txt == null || img == null) { - return; - } - - view.measure((x, y, width, height) => { - this.compare( - 'view', - {x, y, width, height}, - this.state.viewLayout || null, - ); - if (typeof next === 'function') { - next(); - } else if (!this.state.didAnimation) { - // Trigger first state change after onLayout fires - this.animateViewLayout(); - this.state.didAnimation = true; - } - }); - - txt.measure((x, y, width, height) => { - this.compare('txt', {x, y, width, height}, this.state.textLayout); - }); - - img.measure((x, y, width, height) => { - this.compare('img', {x, y, width, height}, this.state.imageLayout); - }); - }; - - compare( - node: string, - measured: LayoutRectangle, - onLayout?: ?LayoutRectangle, - ): void { - if (!deepEquals(measured, onLayout)) { - const data = {measured, onLayout}; - throw new Error( - node + - ' onLayout mismatch with measure ' + - JSON.stringify(data, null, ' '), - ); - } - } - - onViewLayout: (e: LayoutChangeEvent) => void = (e: LayoutChangeEvent) => { - // $FlowFixMe[incompatible-type] - debug('received view layout event\n', e.nativeEvent); - this.setState({viewLayout: e.nativeEvent.layout}, this.checkLayout); - }; - - onTextLayout: (e: LayoutChangeEvent) => void = (e: LayoutChangeEvent) => { - // $FlowFixMe[incompatible-type] - debug('received text layout event\n', e.nativeEvent); - this.setState({textLayout: e.nativeEvent.layout}, this.checkLayout); - }; - - onImageLayout: (e: LayoutChangeEvent) => void = (e: LayoutChangeEvent) => { - // $FlowFixMe[incompatible-type] - debug('received image layout event\n', e.nativeEvent); - this.setState({imageLayout: e.nativeEvent.layout}, this.checkLayout); - }; - - render(): React.Node { - const viewStyle = [styles.view, this.state.viewStyle]; - const textLayout = this.state.textLayout || {width: '?', height: '?'}; - const imageLayout = this.state.imageLayout || {x: '?', y: '?'}; - debug('viewLayout', this.state.viewLayout); - return ( - - { - this._view = ref; - }} - onLayout={this.onViewLayout} - style={viewStyle}> - { - this._img = ref; - }} - onLayout={this.onImageLayout} - style={styles.image} - source={{uri: 'uie_thumb_big.png'}} - /> - { - this._txt = ref; - }} - onLayout={this.onTextLayout} - style={styles.text}> - A simple piece of text.{this.state.extraText} - - - {'\n'} - Text w/h: {textLayout.width}/{textLayout.height + '\n'} - Image x/y: {imageLayout.x}/{imageLayout.y} - - - - ); - } -} - -const styles = StyleSheet.create({ - container: { - margin: 40, - }, - view: { - margin: 20, - padding: 12, - borderColor: 'black', - borderWidth: 0.5, - backgroundColor: 'transparent', - }, - text: { - alignSelf: 'flex-start', - borderColor: 'rgba(0, 0, 255, 0.2)', - borderWidth: 0.5, - }, - image: { - width: 50, - height: 50, - marginBottom: 10, - alignSelf: 'center', - }, -}); - -LayoutEventsTest.displayName = 'LayoutEventsTest'; -export default LayoutEventsTest; diff --git a/packages/rn-tester/IntegrationTests/LoggingTestModule.js b/packages/rn-tester/IntegrationTests/LoggingTestModule.js deleted file mode 100644 index 8350843b9e8c..000000000000 --- a/packages/rn-tester/IntegrationTests/LoggingTestModule.js +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -import invariant from 'invariant'; -import {BatchedBridge} from 'react-native/react-private-interface'; - -const LoggingTestModule = { - logToConsole(message: string): void { - console.log(message); - }, - logToConsoleAfterWait(message: string, delay: number): void { - setTimeout(function () { - console.log(message); - }, delay); - }, - warning(message: string): void { - console.warn(message); - }, - invariant(message: string): void { - invariant(false, message); - }, - logErrorToConsole(message: string): void { - console.error(message); - }, - throwError(message: string): void { - throw new Error(message); - }, -}; - -BatchedBridge.registerCallableModule('LoggingTestModule', LoggingTestModule); diff --git a/packages/rn-tester/IntegrationTests/PromiseTest.js b/packages/rn-tester/IntegrationTests/PromiseTest.js deleted file mode 100644 index 59194c34ca91..000000000000 --- a/packages/rn-tester/IntegrationTests/PromiseTest.js +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -import * as React from 'react'; -import {useEffect, useRef} from 'react'; -import {NativeModules, View} from 'react-native'; - -const {TestModule} = NativeModules; - -function PromiseTest(): React.Node { - const shouldResolve = useRef(false); - const shouldReject = useRef(false); - const shouldSucceedAsync = useRef(false); - const shouldThrowAsync = useRef(false); - - const testShouldResolve = () => { - return TestModule.shouldResolve() - .then(() => { - shouldResolve.current = true; - }) - .catch(() => { - shouldResolve.current = false; - }); - }; - - const testShouldReject = () => { - return TestModule.shouldReject() - .then(() => { - shouldReject.current = false; - }) - .catch(() => { - shouldReject.current = true; - }); - }; - - const testShouldSucceedAsync = async () => { - try { - await TestModule.shouldResolve(); - shouldSucceedAsync.current = true; - } catch (e) { - shouldSucceedAsync.current = false; - } - }; - - const testShouldThrowAsync = async () => { - try { - await TestModule.shouldReject(); - shouldThrowAsync.current = false; - } catch (e) { - shouldThrowAsync.current = true; - } - }; - - useEffect(() => { - async function runTests() { - await Promise.all([ - testShouldResolve(), - testShouldReject(), - testShouldSucceedAsync(), - testShouldThrowAsync(), - ]); - - TestModule.markTestPassed( - shouldResolve.current && - shouldReject.current && - shouldSucceedAsync.current && - shouldThrowAsync.current, - ); - } - - // $FlowFixMe[incompatible-type] - runTests().catch(console.error); - }, []); - - return ; -} - -export default PromiseTest; diff --git a/packages/rn-tester/IntegrationTests/RNTesterDeepEquals.js b/packages/rn-tester/IntegrationTests/RNTesterDeepEquals.js deleted file mode 100644 index b1a2d903640d..000000000000 --- a/packages/rn-tester/IntegrationTests/RNTesterDeepEquals.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -export default function deepEquals(one: unknown, two: unknown): boolean { - if (one === two) { - return true; - } - if (typeof one === 'function' && typeof two === 'function') { - return true; - } - if ( - typeof one !== 'object' || - one === null || - typeof two !== 'object' || - two === null || - one.constructor !== two.constructor - ) { - return false; - } - if (Array.isArray(one)) { - if (!Array.isArray(two) || one.length !== two.length) { - return false; - } - for (let ii = 0; ii < one.length; ii++) { - if (!deepEquals(one[ii], two[ii])) { - return false; - } - } - } else { - for (const key in one) { - if (!deepEquals(one[key], two[key])) { - return false; - } - } - for (const key in two) { - if (one[key] === undefined && two[key] !== undefined) { - return false; - } - } - } - return true; -} diff --git a/packages/rn-tester/IntegrationTests/SimpleSnapshotTest.js b/packages/rn-tester/IntegrationTests/SimpleSnapshotTest.js deleted file mode 100644 index 72ba40aba53e..000000000000 --- a/packages/rn-tester/IntegrationTests/SimpleSnapshotTest.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import * as React from 'react'; -import {useEffect} from 'react'; -import {NativeModules, StyleSheet, View} from 'react-native'; - -const {TestModule} = NativeModules; - -function SimpleSnapshotTest(): React.Node { - const done = (success: boolean) => { - TestModule.markTestPassed(success); - }; - useEffect(() => { - if (!TestModule.verifySnapshot) { - throw new Error('TestModule.verifySnapshot not defined.'); - } - requestAnimationFrame(() => TestModule.verifySnapshot(done)); - }, []); - - return ( - - - - - ); -} - -const styles = StyleSheet.create({ - container: { - backgroundColor: 'white', - padding: 100, - }, - box1: { - width: 80, - height: 50, - backgroundColor: 'red', - }, - box2: { - top: -10, - left: 20, - width: 70, - height: 90, - backgroundColor: 'blue', - }, -}); - -export default SimpleSnapshotTest; diff --git a/packages/rn-tester/IntegrationTests/SyncMethodTest.js b/packages/rn-tester/IntegrationTests/SyncMethodTest.js deleted file mode 100644 index a0f99c2dd115..000000000000 --- a/packages/rn-tester/IntegrationTests/SyncMethodTest.js +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import * as React from 'react'; -import {useEffect} from 'react'; -import {NativeModules, View} from 'react-native'; - -const {TestModule, RNTesterTestModule} = NativeModules; - -function SyncMethodTest(): React.Node { - useEffect(() => { - if ( - RNTesterTestModule.echoString('test string value') !== 'test string value' - ) { - throw new Error('Something wrong with echoString sync method'); - } - if (RNTesterTestModule.methodThatReturnsNil() != null) { - throw new Error('Something wrong with methodThatReturnsNil sync method'); - } - let response; - RNTesterTestModule.methodThatCallsCallbackWithString('test', echo => { - response = echo; - }); - requestAnimationFrame(() => { - if (response === 'test') { - TestModule.markTestCompleted(); - } else { - throw new Error( - 'Something wrong with methodThatCallsCallbackWithString sync method, ' + - 'got response ' + - JSON.stringify(response), - ); - } - }); - }, []); - - return ; -} - -export default SyncMethodTest; diff --git a/packages/rn-tester/IntegrationTests/TimersTest.js b/packages/rn-tester/IntegrationTests/TimersTest.js deleted file mode 100644 index 02c195eea56d..000000000000 --- a/packages/rn-tester/IntegrationTests/TimersTest.js +++ /dev/null @@ -1,312 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const React = require('react'); -const ReactNative = require('react-native'); - -const {StyleSheet, Text, View} = ReactNative; -const {TestModule} = ReactNative.NativeModules; - -type Props = Readonly<{}>; - -type State = { - count: number, - done: boolean, -}; - -type ImmediateID = Object; - -class TimersTest extends React.Component { - _nextTest = () => {}; - _interval: ?ReturnType = null; - - _timeoutIDs: Set> = new Set(); - _intervalIDs: Set> = new Set(); - _immediateIDs: Set = new Set(); - _animationFrameIDs: Set = new Set(); - - state: State = { - count: 0, - done: false, - }; - - setTimeout(fn: () => void, time: number): ReturnType { - const id: ReturnType = setTimeout(() => { - this._timeoutIDs.delete(id); - fn(); - }, time); - - this._timeoutIDs.add(id); - - return id; - } - - clearTimeout(id: ReturnType) { - this._timeoutIDs.delete(id); - clearTimeout(id); - } - - setInterval(fn: () => void, time: number): ReturnType { - const id = setInterval(() => { - fn(); - }, time); - - this._intervalIDs.add(id); - - return id; - } - - clearInterval(id: ReturnType) { - this._intervalIDs.delete(id); - clearInterval(id); - } - - setImmediate(fn: () => void): ImmediateID { - const id: any = setImmediate(() => { - this._immediateIDs.delete(id); - fn(); - }); - - this._immediateIDs.add(id); - - return id; - } - - requestAnimationFrame(fn: () => void): number { - const id: number = requestAnimationFrame(() => { - this._animationFrameIDs.delete(id); - fn(); - }); - - this._animationFrameIDs.add(id); - - return id; - } - - cancelAnimationFrame(id: number): void { - this._animationFrameIDs.delete(id); - cancelAnimationFrame(id); - } - - componentDidMount() { - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this.setTimeout(this.testSetTimeout0, 1000); - } - - testSetTimeout0() { - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this.setTimeout(this.testSetTimeout1, 0); - } - - testSetTimeout1() { - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this.setTimeout(this.testSetTimeout50, 1); - } - - testSetTimeout50() { - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this.setTimeout(this.testRequestAnimationFrame, 50); - } - - testRequestAnimationFrame() { - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this.requestAnimationFrame(this.testSetInterval0); - } - - testSetInterval0() { - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this._nextTest = this.testSetInterval20; - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this._interval = this.setInterval(this._incrementInterval, 0); - } - - testSetInterval20() { - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this._nextTest = this.testSetImmediate; - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this._interval = this.setInterval(this._incrementInterval, 20); - } - - testSetImmediate() { - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this.setImmediate(this.testClearTimeout0); - } - - testClearTimeout0() { - const timeout = this.setTimeout(() => this._fail('testClearTimeout0'), 0); - this.clearTimeout(timeout); - this.testClearTimeout30(); - } - - testClearTimeout30() { - const timeout = this.setTimeout(() => this._fail('testClearTimeout30'), 30); - this.clearTimeout(timeout); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this.setTimeout(this.testClearMulti, 50); - } - - testClearMulti() { - const fails = []; - fails.push(this.setTimeout(() => this._fail('testClearMulti-1'), 20)); - fails.push(this.setTimeout(() => this._fail('testClearMulti-2'), 50)); - const delayClear = this.setTimeout( - () => this._fail('testClearMulti-3'), - 50, - ); - fails.push(this.setTimeout(() => this._fail('testClearMulti-4'), 0)); - fails.push(this.setTimeout(() => this._fail('testClearMulti-5'), 10)); - - fails.forEach(timeout => this.clearTimeout(timeout)); - this.setTimeout(() => this.clearTimeout(delayClear), 20); - - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this.setTimeout(this.testOrdering, 50); - } - - testOrdering() { - // Clear timers are set first because it's more likely to uncover bugs. - let fail0; - this.setImmediate(() => this.clearTimeout(fail0)); - fail0 = this.setTimeout( - () => - this._fail( - 'testOrdering-t0, setImmediate should happen before ' + - 'setTimeout 0', - ), - 0, - ); - let failAnim; // This should fail without the t=0 fastpath feature. - this.setTimeout(() => this.cancelAnimationFrame(failAnim), 0); - failAnim = this.requestAnimationFrame(() => - this._fail( - 'testOrdering-Anim, setTimeout 0 should happen before ' + - 'requestAnimationFrame', - ), - ); - let fail25; - this.setTimeout(() => { - this.clearTimeout(fail25); - }, 20); - fail25 = this.setTimeout( - () => - this._fail( - 'testOrdering-t25, setTimeout 20 should happen before ' + - 'setTimeout 25', - ), - 25, - ); - // $FlowFixMe[method-unbinding] added when improving typing for this parameters - /* $FlowFixMe[incompatible-type] Error exposed after fixing this typing - * unsoundness in flow */ - this.setTimeout(this.done, 50); - } - - done() { - this.setState({done: true}, () => { - TestModule.markTestCompleted(); - }); - } - - componentWillUnmount() { - for (const timeoutID of this._timeoutIDs) { - clearTimeout(timeoutID); - } - - for (const intervalID of this._intervalIDs) { - clearInterval(intervalID); - } - - for (const requestAnimationFrameID of this._animationFrameIDs) { - cancelAnimationFrame(requestAnimationFrameID); - } - - for (const immediateID of this._immediateIDs) { - clearImmediate(immediateID); - } - - this._timeoutIDs = new Set(); - this._intervalIDs = new Set(); - this._animationFrameIDs = new Set(); - this._immediateIDs = new Set(); - - if (this._interval != null) { - clearInterval(this._interval); - this._interval = null; - } - } - - render(): React.Node { - return ( - - - {this.constructor.name + ': \n'} - Intervals: {this.state.count + '\n'} - {this.state.done ? 'Done' : 'Testing...'} - - - ); - } - - _incrementInterval(): void { - if (this.state.count > 3) { - throw new Error('interval incremented past end.'); - } - if (this.state.count === 3) { - if (this._interval != null) { - this.clearInterval(this._interval); - this._interval = null; - } - // $FlowFixMe[method-unbinding] - this.setState({count: 0}, this._nextTest); - return; - } - this.setState({count: this.state.count + 1}); - } - - _fail(caller: string): void { - throw new Error('_fail called by ' + caller); - } -} - -const styles = StyleSheet.create({ - container: { - backgroundColor: 'white', - padding: 40, - }, -}); - -TimersTest.displayName = 'TimersTest'; -export default TimersTest; diff --git a/packages/rn-tester/IntegrationTests/WebSocketTest.js b/packages/rn-tester/IntegrationTests/WebSocketTest.js deleted file mode 100644 index 944d32642fa5..000000000000 --- a/packages/rn-tester/IntegrationTests/WebSocketTest.js +++ /dev/null @@ -1,154 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - * @format - */ - -'use strict'; - -const React = require('react'); -const ReactNative = require('react-native'); - -const {View} = ReactNative; -const {TestModule} = ReactNative.NativeModules; - -const DEFAULT_WS_URL = 'ws://localhost:5555/'; - -const WS_EVENTS = ['close', 'error', 'message', 'open']; - -type State = { - url: string, - fetchStatus: ?string, - socket: ?WebSocket, - socketState: ?number, - lastSocketEvent: ?string, - lastMessage: ?string | ?ArrayBuffer, - testMessage: string, - testExpectedResponse: string, - ... -}; - -class WebSocketTest extends React.Component<{...}, State> { - state: State = { - url: DEFAULT_WS_URL, - fetchStatus: null, - socket: null, - socketState: null, - lastSocketEvent: null, - lastMessage: null, - testMessage: 'testMessage', - testExpectedResponse: 'testMessage_response', - }; - - _waitFor = (condition: any, timeout: any, callback: any) => { - let remaining = timeout; - const timeoutFunction = function () { - if (condition()) { - callback(true); - return; - } - remaining--; - if (remaining === 0) { - callback(false); - } else { - setTimeout(timeoutFunction, 1000); - } - }; - setTimeout(timeoutFunction, 1000); - }; - - _connect = () => { - const socket = new WebSocket(this.state.url); - WS_EVENTS.forEach(ev => socket.addEventListener(ev, this._onSocketEvent)); - this.setState({ - socket, - socketState: socket.readyState, - }); - }; - - _socketIsConnected = (): boolean => { - return this.state.socketState === 1; //'OPEN' - }; - - _socketIsDisconnected = (): boolean => { - return this.state.socketState === 3; //'CLOSED' - }; - - _disconnect = () => { - if (!this.state.socket) { - return; - } - this.state.socket.close(); - }; - - _onSocketEvent = (event: any) => { - const state: any = { - socketState: event.target.readyState, - lastSocketEvent: event.type, - }; - if (event.type === 'message') { - state.lastMessage = event.data; - } - this.setState(state); - }; - - _sendText = (text: string) => { - if (!this.state.socket) { - return; - } - this.state.socket.send(text); - }; - - _sendTestMessage = () => { - this._sendText(this.state.testMessage); - }; - - _receivedTestExpectedResponse = (): boolean => { - return this.state.lastMessage === this.state.testExpectedResponse; - }; - - componentDidMount() { - this.testConnect(); - } - - testConnect: () => void = () => { - this._connect(); - this._waitFor(this._socketIsConnected, 5, connectSucceeded => { - if (!connectSucceeded) { - TestModule.markTestPassed(false); - return; - } - this.testSendAndReceive(); - }); - }; - - testSendAndReceive: () => void = () => { - this._sendTestMessage(); - this._waitFor(this._receivedTestExpectedResponse, 5, messageReceived => { - if (!messageReceived) { - TestModule.markTestPassed(false); - return; - } - this.testDisconnect(); - }); - }; - - testDisconnect: () => void = () => { - this._disconnect(); - this._waitFor(this._socketIsDisconnected, 5, disconnectSucceeded => { - TestModule.markTestPassed(disconnectSucceeded); - }); - }; - - render(): React.Node { - return ; - } -} - -WebSocketTest.displayName = 'WebSocketTest'; - -export default WebSocketTest; diff --git a/packages/rn-tester/IntegrationTests/blue_square.png b/packages/rn-tester/IntegrationTests/blue_square.png deleted file mode 100644 index 4974e084c636..000000000000 Binary files a/packages/rn-tester/IntegrationTests/blue_square.png and /dev/null differ diff --git a/packages/rn-tester/IntegrationTests/launchWebSocketServer.sh b/packages/rn-tester/IntegrationTests/launchWebSocketServer.sh deleted file mode 100755 index cc736a5ceffd..000000000000 --- a/packages/rn-tester/IntegrationTests/launchWebSocketServer.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd) -pushd "$THIS_DIR" || exit -./websocket_integration_test_server.js -popd || exit - -echo "Process terminated." diff --git a/packages/rn-tester/IntegrationTests/red_square.png b/packages/rn-tester/IntegrationTests/red_square.png deleted file mode 100644 index 0977a3e8cf33..000000000000 Binary files a/packages/rn-tester/IntegrationTests/red_square.png and /dev/null differ diff --git a/packages/rn-tester/IntegrationTests/websocket_integration_test_server.js b/packages/rn-tester/IntegrationTests/websocket_integration_test_server.js deleted file mode 100755 index 33f81521640c..000000000000 --- a/packages/rn-tester/IntegrationTests/websocket_integration_test_server.js +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env node -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -/* eslint-env node */ - -const WebSocket = require('ws'); - -console.log(`\ -WebSocket integration test server - -This will send each incoming message back, with the string '_response' appended. -An incoming message of 'exit' will shut down the server. - -`); - -const server = new WebSocket.Server({port: 5555}); -server.on('connection', ws => { - ws.on('message', message => { - console.log('Received message:', message); - if (message === 'exit') { - console.log('WebSocket integration test server exit'); - process.exit(0); - } - ws.send(String(message) + '_response'); - }); - - ws.send('hello'); -}); diff --git a/packages/rn-tester/Podfile b/packages/rn-tester/Podfile index 2ccaa665087c..37fce7a19e78 100644 --- a/packages/rn-tester/Podfile +++ b/packages/rn-tester/Podfile @@ -64,15 +64,9 @@ 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 diff --git a/packages/rn-tester/Podfile.lock b/packages/rn-tester/Podfile.lock index e05fb962dc81..a7b25b10a6aa 100644 --- a/packages/rn-tester/Podfile.lock +++ b/packages/rn-tester/Podfile.lock @@ -2354,12 +2354,6 @@ PODS: - React-RCTFBReactNativeSpec - ReactCommon - SocketRocket - - React-RCTTest (1000.0.0): - - boost - - DoubleConversion - - fast_float - - fmt - - glog - RCT-Folly - RCT-Folly/Fabric - React-Core (= 1000.0.0) @@ -2775,7 +2769,6 @@ DEPENDENCIES: - React-RCTPushNotification (from `../react-native/Libraries/PushNotificationIOS`) - React-RCTRuntime (from `../react-native/React/Runtime`) - React-RCTSettings (from `../react-native/Libraries/Settings`) - - React-RCTTest (from `./RCTTest`) - React-RCTText (from `../react-native/Libraries/Text`) - React-RCTVibration (from `../react-native/Libraries/Vibration`) - React-rendererconsistency (from `../react-native/ReactCommon/react/renderer/consistency`) @@ -2940,8 +2933,6 @@ EXTERNAL SOURCES: :path: "../react-native/React/Runtime" React-RCTSettings: :path: "../react-native/Libraries/Settings" - React-RCTTest: - :path: "./RCTTest" React-RCTText: :path: "../react-native/Libraries/Text" React-RCTVibration: @@ -3054,7 +3045,6 @@ SPEC CHECKSUMS: React-RCTPushNotification: 49c1acca24d107235c15a61af9ed856ef9e4c956 React-RCTRuntime: feb1d8054fd1128af1622a6ec477ed5585dd01cc React-RCTSettings: a932ad87f8dc6601deb45220a9bfa7da4a44df03 - React-RCTTest: 35876bf3e89cbbb357d52292f0e525996e5ce60c React-RCTText: 16b0e933027bd04a5fc594461cb7691cd7eaaa56 React-RCTVibration: fa7447c8f2435d18eb07e507e088c77cc6dbf61c React-rendererconsistency: 7953edf876fa2626cfe7513f8a96dcb87e4be3ae diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.h b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.h deleted file mode 100644 index 327e3972d974..000000000000 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import - -#ifndef FB_REFERENCE_IMAGE_DIR -#define FB_REFERENCE_IMAGE_DIR "\"$(SOURCE_ROOT)/$(PROJECT_NAME)Tests/ReferenceImages\"" -#endif - -/** - The base class of view snapshotting tests. If you have small UI component, it's often easier to configure it in a test - and compare an image of the view to a reference image that write lots of complex layout-code tests. - - In order to flip the tests in your subclass to record the reference images set `recordMode` to YES before calling - -[super setUp]. - */ -@interface FBSnapshotTestCase : XCTestCase - -/** - When YES, the test macros will save reference images, rather than performing an actual test. - */ -@property (readwrite, nonatomic, assign) BOOL recordMode; - -/** - Performs the comparisons or records a snapshot of the view if recordMode is YES. - @param view The view to snapshot - @param referenceImagesDirectory The directory in which reference images are stored. - @param identifier An optional identifier, used if there are multiple snapshot tests in a given -test method. - @param error An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc). - @returns YES if the comparison (or saving of the reference image) succeeded. - */ -- (BOOL)compareSnapshotOfView:(UIView *)view - referenceImagesDirectory:(NSString *)referenceImagesDirectory - identifier:(NSString *)identifier - error:(NSError **)errorPtr; - -@end diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.m b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.m deleted file mode 100644 index 9e5a14c2c3e2..000000000000 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestCase.m +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "FBSnapshotTestCase.h" - -#import "FBSnapshotTestController.h" - -@interface FBSnapshotTestCase () - -@property (readwrite, nonatomic, retain) FBSnapshotTestController *snapshotController; - -@end - -@implementation FBSnapshotTestCase - -- (void)setUp -{ - [super setUp]; - self.snapshotController = [[FBSnapshotTestController alloc] initWithTestName:NSStringFromClass([self class])]; -} - -- (void)tearDown -{ - self.snapshotController = nil; - [super tearDown]; -} - -- (BOOL)recordMode -{ - return self.snapshotController.recordMode; -} - -- (void)setRecordMode:(BOOL)recordMode -{ - self.snapshotController.recordMode = recordMode; -} - -- (BOOL)compareSnapshotOfView:(UIView *)view - referenceImagesDirectory:(NSString *)referenceImagesDirectory - identifier:(NSString *)identifier - error:(NSError **)errorPtr -{ - _snapshotController.referenceImagesDirectory = referenceImagesDirectory; - return [_snapshotController compareSnapshotOfView:view - selector:self.invocation.selector - identifier:identifier - error:errorPtr]; -} - -@end diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.h b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.h deleted file mode 100644 index f220d0fd6fd0..000000000000 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -typedef NS_ENUM(NSInteger, FBSnapshotTestControllerErrorCode) { - FBSnapshotTestControllerErrorCodeUnknown, - FBSnapshotTestControllerErrorCodeNeedsRecord, - FBSnapshotTestControllerErrorCodePNGCreationFailed, - FBSnapshotTestControllerErrorCodeImagesDifferentSizes, - FBSnapshotTestControllerErrorCodeImagesDifferent, -}; -/** - Errors returned by the methods of FBSnapshotTestController use this domain. - */ -extern NSString *const FBSnapshotTestControllerErrorDomain; - -/** - Errors returned by the methods of FBSnapshotTestController sometimes contain this key in the `userInfo` dictionary. - */ -extern NSString *const FBReferenceImageFilePathKey; - -/** - Provides the heavy-lifting for FBSnapshotTestCase. It loads and saves images, along with performing the actual pixel- - by-pixel comparison of images. - Instances are initialized with the test class, and directories to read and write to. - */ -@interface FBSnapshotTestController : NSObject - -/** - Record snapshots. - **/ -@property (readwrite, nonatomic, assign) BOOL recordMode; - -/** - @param testClass The subclass of FBSnapshotTestCase that is using this controller. - @returns An instance of FBSnapshotTestController. - */ -- (id)initWithTestClass:(Class)testClass; - -/** - Designated initializer. - @param testName The name of the tests. - @returns An instance of FBSnapshotTestController. - */ -- (id)initWithTestName:(NSString *)testName; - -/** - Performs the comparison of the view. - @param view The view to snapshot. - @param selector selector - @param identifier An optional identifier, used is there are multiple snapshot tests in a given -test method. - @param errorPtr An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, - etc). - @returns YES if the comparison (or saving of the reference image) succeeded. - */ -- (BOOL)compareSnapshotOfView:(UIView *)view - selector:(SEL)selector - identifier:(NSString *)identifier - error:(NSError **)errorPtr; - -/** - The directory in which reference images are stored. - */ -@property (readwrite, nonatomic, copy) NSString *referenceImagesDirectory; - -/** - Loads a reference image. - @param selector The test method being run. - @param identifier The optional identifier, used when multiple images are tested in a single -test method. - @param error An error, if this methods returns nil, the error will be something useful. - @returns An image. - */ -- (UIImage *)referenceImageForSelector:(SEL)selector identifier:(NSString *)identifier error:(NSError **)error; - -/** - Saves a reference image. - @param selector The test method being run. - @param identifier The optional identifier, used when multiple images are tested in a single -test method. - @param errorPtr An error, if this methods returns NO, the error will be something useful. - @returns An image. - */ -- (BOOL)saveReferenceImage:(UIImage *)image - selector:(SEL)selector - identifier:(NSString *)identifier - error:(NSError **)errorPtr; - -/** - Performs a pixel-by-pixel comparison of the two images. - @param referenceImage The reference (correct) image. - @param image The image to test against the reference. - @param errorPtr An error that indicates why the comparison failed if it does. - @returns YES if the comparison succeeded and the images are the same. - */ -- (BOOL)compareReferenceImage:(UIImage *)referenceImage toImage:(UIImage *)image error:(NSError **)errorPtr; - -/** - Saves the reference image and the test image to `failedOutputDirectory`. - @param referenceImage The reference (correct) image. - @param testImage The image to test against the reference. - @param selector The test method being run. - @param identifier The optional identifier, used when multiple images are tested in a single -test method. - @param errorPtr An error that indicates why the comparison failed if it does. - @returns YES if the save succeeded. - */ -- (BOOL)saveFailedReferenceImage:(UIImage *)referenceImage - testImage:(UIImage *)testImage - selector:(SEL)selector - identifier:(NSString *)identifier - error:(NSError **)errorPtr; -@end diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m b/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m deleted file mode 100644 index 261def2c6c77..000000000000 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/FBSnapshotTestController.m +++ /dev/null @@ -1,337 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "FBSnapshotTestController.h" - -#import - -#import - -#import "UIImage+Compare.h" -#import "UIImage+Diff.h" - -NSString *const FBSnapshotTestControllerErrorDomain = @"FBSnapshotTestControllerErrorDomain"; - -NSString *const FBReferenceImageFilePathKey = @"FBReferenceImageFilePathKey"; - -typedef struct RGBAPixel { - char r; - char g; - char b; - char a; -} RGBAPixel; - -@interface FBSnapshotTestController () - -@property (readonly, nonatomic, copy) NSString *testName; - -@end - -@implementation FBSnapshotTestController { - NSFileManager *_fileManager; -} - -#pragma mark - Lifecycle - -- (instancetype)initWithTestClass:(Class)testClass -{ - return [self initWithTestName:NSStringFromClass(testClass)]; -} - -- (instancetype)initWithTestName:(NSString *)testName -{ - if ((self = [super init])) { - _testName = [testName copy]; - _fileManager = [NSFileManager new]; - } - return self; -} - -#pragma mark - Properties - -- (NSString *)description -{ - return [NSString stringWithFormat:@"%@ %@", [super description], _referenceImagesDirectory]; -} - -#pragma mark - Public API - -- (UIImage *)referenceImageForSelector:(SEL)selector identifier:(NSString *)identifier error:(NSError **)errorPtr -{ - NSString *filePath = [self _referenceFilePathForSelector:selector identifier:identifier]; - UIImage *image = [UIImage imageWithContentsOfFile:filePath]; - if (nil == image && NULL != errorPtr) { - BOOL exists = [_fileManager fileExistsAtPath:filePath]; - if (!exists) { - *errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain - code:FBSnapshotTestControllerErrorCodeNeedsRecord - userInfo:@{ - FBReferenceImageFilePathKey : filePath, - NSLocalizedDescriptionKey : @"Unable to load reference image.", - NSLocalizedFailureReasonErrorKey : - @"Reference image not found. You need to run the test in record mode", - }]; - } else { - *errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain - code:FBSnapshotTestControllerErrorCodeUnknown - userInfo:nil]; - } - } - return image; -} - -- (BOOL)saveReferenceImage:(UIImage *)image - selector:(SEL)selector - identifier:(NSString *)identifier - error:(NSError **)errorPtr -{ - BOOL didWrite = NO; - if (nil != image) { - NSString *filePath = [self _referenceFilePathForSelector:selector identifier:identifier]; - NSData *pngData = UIImagePNGRepresentation(image); - if (nil != pngData) { - NSError *creationError = nil; - BOOL didCreateDir = [_fileManager createDirectoryAtPath:[filePath stringByDeletingLastPathComponent] - withIntermediateDirectories:YES - attributes:nil - error:&creationError]; - if (!didCreateDir) { - if (NULL != errorPtr) { - *errorPtr = creationError; - } - return NO; - } - didWrite = [pngData writeToFile:filePath options:NSDataWritingAtomic error:errorPtr]; - if (didWrite) { - NSLog(@"Reference image save at: %@", filePath); - } - } else { - if (nil != errorPtr) { - *errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain - code:FBSnapshotTestControllerErrorCodePNGCreationFailed - userInfo:@{ - FBReferenceImageFilePathKey : filePath, - }]; - } - } - } - return didWrite; -} - -- (BOOL)saveFailedReferenceImage:(UIImage *)referenceImage - testImage:(UIImage *)testImage - selector:(SEL)selector - identifier:(NSString *)identifier - error:(NSError **)errorPtr -{ - NSData *referencePNGData = UIImagePNGRepresentation(referenceImage); - NSData *testPNGData = UIImagePNGRepresentation(testImage); - - NSString *referencePath = [self _failedFilePathForSelector:selector - identifier:identifier - fileNameType:FBTestSnapshotFileNameTypeFailedReference]; - - NSError *creationError = nil; - BOOL didCreateDir = [_fileManager createDirectoryAtPath:[referencePath stringByDeletingLastPathComponent] - withIntermediateDirectories:YES - attributes:nil - error:&creationError]; - if (!didCreateDir) { - if (NULL != errorPtr) { - *errorPtr = creationError; - } - return NO; - } - - if (![referencePNGData writeToFile:referencePath options:NSDataWritingAtomic error:errorPtr]) { - return NO; - } - - NSString *testPath = [self _failedFilePathForSelector:selector - identifier:identifier - fileNameType:FBTestSnapshotFileNameTypeFailedTest]; - - if (![testPNGData writeToFile:testPath options:NSDataWritingAtomic error:errorPtr]) { - return NO; - } - - NSString *diffPath = [self _failedFilePathForSelector:selector - identifier:identifier - fileNameType:FBTestSnapshotFileNameTypeFailedTestDiff]; - - UIImage *diffImage = [referenceImage diffWithImage:testImage]; - NSData *diffImageData = UIImagePNGRepresentation(diffImage); - - if (![diffImageData writeToFile:diffPath options:NSDataWritingAtomic error:errorPtr]) { - return NO; - } - - NSLog( - @"If you have Kaleidoscope installed you can run this command to see an image diff:\n" - @"ksdiff \"%@\" \"%@\"", - referencePath, - testPath); - - return YES; -} - -- (BOOL)compareReferenceImage:(UIImage *)referenceImage toImage:(UIImage *)image error:(NSError **)errorPtr -{ - if (CGSizeEqualToSize(referenceImage.size, image.size)) { - BOOL imagesEqual = [referenceImage compareWithImage:image]; - if (NULL != errorPtr) { - *errorPtr = [NSError errorWithDomain:FBSnapshotTestControllerErrorDomain - code:FBSnapshotTestControllerErrorCodeImagesDifferent - userInfo:@{ - NSLocalizedDescriptionKey : @"Images different", - }]; - } - return imagesEqual; - } - if (NULL != errorPtr) { - *errorPtr = [NSError - errorWithDomain:FBSnapshotTestControllerErrorDomain - code:FBSnapshotTestControllerErrorCodeImagesDifferentSizes - userInfo:@{ - NSLocalizedDescriptionKey : @"Images different sizes", - NSLocalizedFailureReasonErrorKey : [NSString stringWithFormat:@"referenceImage:%@, image:%@", - NSStringFromCGSize(referenceImage.size), - NSStringFromCGSize(image.size)], - }]; - } - return NO; -} - -#pragma mark - Private API - -typedef NS_ENUM(NSInteger, FBTestSnapshotFileNameType) { - FBTestSnapshotFileNameTypeReference, - FBTestSnapshotFileNameTypeFailedReference, - FBTestSnapshotFileNameTypeFailedTest, - FBTestSnapshotFileNameTypeFailedTestDiff, -}; - -- (NSString *)_fileNameForSelector:(SEL)selector - identifier:(NSString *)identifier - fileNameType:(FBTestSnapshotFileNameType)fileNameType -{ - NSString *fileName = nil; - switch (fileNameType) { - case FBTestSnapshotFileNameTypeFailedReference: - fileName = @"reference_"; - break; - case FBTestSnapshotFileNameTypeFailedTest: - fileName = @"failed_"; - break; - case FBTestSnapshotFileNameTypeFailedTestDiff: - fileName = @"diff_"; - break; - default: - fileName = @""; - break; - } - fileName = [fileName stringByAppendingString:NSStringFromSelector(selector)]; - if (0 < identifier.length) { - fileName = [fileName stringByAppendingFormat:@"_%@", identifier]; - } - - UITraitCollection *currentTraitCollection = [UITraitCollection currentTraitCollection]; - if (currentTraitCollection.displayScale > 1.0) { - fileName = [fileName stringByAppendingFormat:@"@%.fx", currentTraitCollection.displayScale]; - } - fileName = [fileName stringByAppendingPathExtension:@"png"]; - return fileName; -} - -- (NSString *)_referenceFilePathForSelector:(SEL)selector identifier:(NSString *)identifier -{ - NSString *fileName = [self _fileNameForSelector:selector - identifier:identifier - fileNameType:FBTestSnapshotFileNameTypeReference]; - NSString *filePath = [_referenceImagesDirectory stringByAppendingPathComponent:_testName]; - filePath = [filePath stringByAppendingPathComponent:fileName]; - return filePath; -} - -- (NSString *)_failedFilePathForSelector:(SEL)selector - identifier:(NSString *)identifier - fileNameType:(FBTestSnapshotFileNameType)fileNameType -{ - NSString *fileName = [self _fileNameForSelector:selector identifier:identifier fileNameType:fileNameType]; - NSString *folderPath = NSTemporaryDirectory(); - if (getenv("IMAGE_DIFF_DIR")) { - folderPath = @(getenv("IMAGE_DIFF_DIR")); - } - NSString *filePath = [folderPath stringByAppendingPathComponent:_testName]; - filePath = [filePath stringByAppendingPathComponent:fileName]; - return filePath; -} - -- (BOOL)compareSnapshotOfView:(id)view - selector:(SEL)selector - identifier:(NSString *)identifier - error:(NSError **)errorPtr -{ - if (self.recordMode) { - return [self _recordSnapshotOfView:view selector:selector identifier:identifier error:errorPtr]; - } else { - return [self _performPixelComparisonWithView:view selector:selector identifier:identifier error:errorPtr]; - } -} - -#pragma mark - Private API - -- (BOOL)_performPixelComparisonWithView:(UIView *)view - selector:(SEL)selector - identifier:(NSString *)identifier - error:(NSError **)errorPtr -{ - UIImage *referenceImage = [self referenceImageForSelector:selector identifier:identifier error:errorPtr]; - if (nil != referenceImage) { - UIImage *snapshot = [self _snapshotView:view]; - BOOL imagesSame = [self compareReferenceImage:referenceImage toImage:snapshot error:errorPtr]; - if (!imagesSame) { - [self saveFailedReferenceImage:referenceImage - testImage:snapshot - selector:selector - identifier:identifier - error:errorPtr]; - } - return imagesSame; - } - return NO; -} - -- (BOOL)_recordSnapshotOfView:(UIView *)view - selector:(SEL)selector - identifier:(NSString *)identifier - error:(NSError **)errorPtr -{ - UIImage *snapshot = [self _snapshotView:view]; - return [self saveReferenceImage:snapshot selector:selector identifier:identifier error:errorPtr]; -} - -- (UIImage *)_snapshotView:(UIView *)view -{ - [view layoutIfNeeded]; - - CGRect bounds = view.bounds; - - NSAssert1(CGRectGetWidth(bounds), @"Zero width for view %@", view); - NSAssert1(CGRectGetHeight(bounds), @"Zero height for view %@", view); - - UIGraphicsImageRendererFormat *const rendererFormat = [UIGraphicsImageRendererFormat defaultFormat]; - UIGraphicsImageRenderer *const renderer = [[UIGraphicsImageRenderer alloc] initWithSize:bounds.size - format:rendererFormat]; - - return [renderer imageWithActions:^(UIGraphicsImageRendererContext *_Nonnull context) { - BOOL success = [view drawViewHierarchyInRect:bounds afterScreenUpdates:YES]; - NSAssert1(success, @"Could not create snapshot for view %@", view); - }]; -} - -@end diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.h b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.h deleted file mode 100644 index e84bbc6ea995..000000000000 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface UIImage (Compare) - -- (BOOL)compareWithImage:(UIImage *)image; - -@end diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.m b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.m deleted file mode 100644 index e46d975ea0b8..000000000000 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Compare.m +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "UIImage+Compare.h" - -@implementation UIImage (Compare) - -- (BOOL)compareWithImage:(UIImage *)image -{ - NSAssert(CGSizeEqualToSize(self.size, image.size), @"Images must be same size."); - - // The images have the equal size, so we could use the smallest amount of bytes because of byte padding - size_t minBytesPerRow = MIN(CGImageGetBytesPerRow(self.CGImage), CGImageGetBytesPerRow(image.CGImage)); - size_t referenceImageSizeBytes = CGImageGetHeight(self.CGImage) * minBytesPerRow; - void *referenceImagePixels = calloc(1, referenceImageSizeBytes); - void *imagePixels = calloc(1, referenceImageSizeBytes); - - if (!referenceImagePixels || !imagePixels) { - free(referenceImagePixels); - free(imagePixels); - return NO; - } - - CGContextRef referenceImageContext = CGBitmapContextCreate( - referenceImagePixels, - CGImageGetWidth(self.CGImage), - CGImageGetHeight(self.CGImage), - CGImageGetBitsPerComponent(self.CGImage), - minBytesPerRow, - CGImageGetColorSpace(self.CGImage), - (CGBitmapInfo)kCGImageAlphaPremultipliedLast); - CGContextRef imageContext = CGBitmapContextCreate( - imagePixels, - CGImageGetWidth(image.CGImage), - CGImageGetHeight(image.CGImage), - CGImageGetBitsPerComponent(image.CGImage), - minBytesPerRow, - CGImageGetColorSpace(image.CGImage), - (CGBitmapInfo)kCGImageAlphaPremultipliedLast); - - CGFloat scaleFactor = [UITraitCollection currentTraitCollection].displayScale; - CGContextScaleCTM(referenceImageContext, scaleFactor, scaleFactor); - CGContextScaleCTM(imageContext, scaleFactor, scaleFactor); - - if (!referenceImageContext || !imageContext) { - CGContextRelease(referenceImageContext); - CGContextRelease(imageContext); - free(referenceImagePixels); - free(imagePixels); - return NO; - } - - CGContextDrawImage(referenceImageContext, CGRectMake(0.0f, 0.0f, self.size.width, self.size.height), self.CGImage); - CGContextDrawImage(imageContext, CGRectMake(0.0f, 0.0f, image.size.width, image.size.height), image.CGImage); - CGContextRelease(referenceImageContext); - CGContextRelease(imageContext); - - BOOL imageEqual = (memcmp(referenceImagePixels, imagePixels, referenceImageSizeBytes) == 0); - free(referenceImagePixels); - free(imagePixels); - return imageEqual; -} - -@end diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.h b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.h deleted file mode 100644 index 4bf6f527846e..000000000000 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface UIImage (Diff) - -- (UIImage *)diffWithImage:(UIImage *)image; - -@end diff --git a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.m b/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.m deleted file mode 100644 index 178f988fa595..000000000000 --- a/packages/rn-tester/RCTTest/FBSnapshotTestCase/UIImage+Diff.m +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "UIImage+Diff.h" - -@implementation UIImage (Diff) - -- (UIImage *)diffWithImage:(UIImage *)image -{ - if (!image) { - return nil; - } - CGSize imageSize = CGSizeMake(MAX(self.size.width, image.size.width), MAX(self.size.height, image.size.height)); - - UIGraphicsImageRendererFormat *const rendererFormat = [UIGraphicsImageRendererFormat defaultFormat]; - rendererFormat.opaque = YES; - UIGraphicsImageRenderer *const renderer = [[UIGraphicsImageRenderer alloc] initWithSize:imageSize - format:rendererFormat]; - - return [renderer imageWithActions:^(UIGraphicsImageRendererContext *_Nonnull rendererContext) { - const CGContextRef context = rendererContext.CGContext; - [self drawInRect:CGRectMake(0, 0, self.size.width, self.size.height)]; - CGContextSetAlpha(context, 0.5f); - CGContextBeginTransparencyLayer(context, NULL); - [image drawInRect:CGRectMake(0, 0, image.size.width, image.size.height)]; - CGContextSetBlendMode(context, kCGBlendModeDifference); - CGContextSetFillColorWithColor(context, [UIColor whiteColor].CGColor); - CGContextFillRect(context, CGRectMake(0, 0, self.size.width, self.size.height)); - CGContextEndTransparencyLayer(context); - }]; -} - -@end diff --git a/packages/rn-tester/RCTTest/RCTSnapshotManager.h b/packages/rn-tester/RCTTest/RCTSnapshotManager.h deleted file mode 100644 index 4cd67c2a1425..000000000000 --- a/packages/rn-tester/RCTTest/RCTSnapshotManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface RCTSnapshotManager : RCTViewManager - -@end diff --git a/packages/rn-tester/RCTTest/RCTSnapshotManager.m b/packages/rn-tester/RCTTest/RCTSnapshotManager.m deleted file mode 100644 index 7b17622015af..000000000000 --- a/packages/rn-tester/RCTTest/RCTSnapshotManager.m +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTSnapshotManager.h" - -@interface RCTSnapshotView : UIView - -@property (nonatomic, copy) RCTDirectEventBlock onSnapshotReady; -@property (nonatomic, copy) NSString *testIdentifier; - -@end - -@implementation RCTSnapshotView - -- (void)setTestIdentifier:(NSString *)testIdentifier -{ - if (![_testIdentifier isEqualToString:testIdentifier]) { - _testIdentifier = [testIdentifier copy]; - dispatch_async(dispatch_get_main_queue(), ^{ - if (self.onSnapshotReady) { - self.onSnapshotReady(@{@"testIdentifier" : self.testIdentifier}); - } - }); - } -} - -@end - -@implementation RCTSnapshotManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [RCTSnapshotView new]; -} - -RCT_EXPORT_VIEW_PROPERTY(testIdentifier, NSString) -RCT_EXPORT_VIEW_PROPERTY(onSnapshotReady, RCTDirectEventBlock) - -@end diff --git a/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js b/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js deleted file mode 100644 index b43ac61f079b..000000000000 --- a/packages/rn-tester/RCTTest/RCTSnapshotNativeComponent.js +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict-local - * @format - */ - -'use strict'; - -import type { - HostComponent, - NativeSyntheticEvent, - ViewProps, -} from 'react-native'; - -const {requireNativeComponent} = require('react-native'); - -type SnapshotReadyEvent = NativeSyntheticEvent< - Readonly<{testIdentifier: string, ...}>, ->; - -type NativeProps = Readonly<{ - ...ViewProps, - onSnapshotReady?: ?(event: SnapshotReadyEvent) => unknown, - testIdentifier?: ?string, -}>; - -const RCTSnapshotNativeComponent: HostComponent = - requireNativeComponent('RCTSnapshot'); - -module.exports = RCTSnapshotNativeComponent; diff --git a/packages/rn-tester/RCTTest/RCTTestModule.h b/packages/rn-tester/RCTTest/RCTTestModule.h deleted file mode 100644 index 5f60be764db2..000000000000 --- a/packages/rn-tester/RCTTest/RCTTestModule.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import - -typedef NS_ENUM(NSInteger, RCTTestStatus) { RCTTestStatusPending = 0, RCTTestStatusPassed, RCTTestStatusFailed }; - -@class FBSnapshotTestController; - -@interface RCTTestModule : NSObject - -/** - * The snapshot test controller for this module. - */ -@property (nonatomic, strong) FBSnapshotTestController *controller; - -/** - * This is the view to be snapshotted. - */ -@property (nonatomic, strong) UIView *view; - -/** - * This is used to give meaningful names to snapshot image files. - */ -@property (nonatomic, assign) SEL testSelector; - -/** - * This is polled while running the runloop until true. - */ -@property (nonatomic, readonly) RCTTestStatus status; - -@property (nonatomic, copy) NSString *testSuffix; - -@end diff --git a/packages/rn-tester/RCTTest/RCTTestModule.mm b/packages/rn-tester/RCTTest/RCTTestModule.mm deleted file mode 100644 index 4276d33dd77f..000000000000 --- a/packages/rn-tester/RCTTest/RCTTestModule.mm +++ /dev/null @@ -1,172 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTestModule.h" - -#import -#import -#import -#import -#import - -#import "FBSnapshotTestController.h" - -#import "RCTTestPlugins.h" - -@protocol NativeTestModuleSpec - -- (void)markTestCompleted; -- (void)markTestPassed:(BOOL)success; -- (void)verifySnapshot:(RCTResponseSenderBlock)callback; - -@end - -namespace facebook { -namespace react { -/** - * ObjC++ class for module 'TestModule' - */ - -class JSI_EXPORT NativeTestModuleSpecJSI : public ObjCTurboModule { - public: - NativeTestModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms); -}; -} // namespace react -} // namespace facebook - -namespace facebook { -namespace react { - -static facebook::jsi::Value __hostFunction_NativeTestModuleSpecJSI_markTestCompleted( - facebook::jsi::Runtime &rt, - TurboModule &turboModule, - const facebook::jsi::Value *args, - size_t count) -{ - return static_cast(turboModule) - .invokeObjCMethod(rt, VoidKind, "markTestCompleted", @selector(markTestCompleted), args, count); -} - -static facebook::jsi::Value __hostFunction_NativeTestModuleSpecJSI_markTestPassed( - facebook::jsi::Runtime &rt, - TurboModule &turboModule, - const facebook::jsi::Value *args, - size_t count) -{ - return static_cast(turboModule) - .invokeObjCMethod(rt, VoidKind, "markTestPassed", @selector(markTestPassed:), args, count); -} - -static facebook::jsi::Value __hostFunction_NativeTestModuleSpecJSI_verifySnapshot( - facebook::jsi::Runtime &rt, - TurboModule &turboModule, - const facebook::jsi::Value *args, - size_t count) -{ - return static_cast(turboModule) - .invokeObjCMethod(rt, VoidKind, "verifySnapshot", @selector(verifySnapshot:), args, count); -} - -NativeTestModuleSpecJSI::NativeTestModuleSpecJSI(const ObjCTurboModule::InitParams ¶ms) : ObjCTurboModule(params) -{ - methodMap_["markTestCompleted"] = MethodMetadata{0, __hostFunction_NativeTestModuleSpecJSI_markTestCompleted}; - - methodMap_["markTestPassed"] = MethodMetadata{1, __hostFunction_NativeTestModuleSpecJSI_markTestPassed}; - - methodMap_["verifySnapshot"] = MethodMetadata{1, __hostFunction_NativeTestModuleSpecJSI_verifySnapshot}; -} - -} // namespace react -} // namespace facebook - -@interface RCTTestModule () -@end - -@implementation RCTTestModule { - NSMutableDictionary *_snapshotCounter; -} - -@synthesize moduleRegistry = _moduleRegistry; -@synthesize viewRegistry_DEPRECATED = _viewRegistry_DEPRECATED; - -RCT_EXPORT_MODULE() - -- (void)verifySnapshot:(RCTResponseSenderBlock)callback -{ - RCTAssert(_controller != nil, @"No snapshot controller configured."); - - [_viewRegistry_DEPRECATED addUIBlock:^(__unused RCTViewRegistry *viewRegistry) { - NSString *testName = NSStringFromSelector(self->_testSelector); - if (!self->_snapshotCounter) { - self->_snapshotCounter = [NSMutableDictionary new]; - } - - NSNumber *counter = @([self->_snapshotCounter[testName] integerValue] + 1); - self->_snapshotCounter[testName] = counter; - - NSError *error = nil; - NSString *identifier = [counter stringValue]; - if (self->_testSuffix) { - identifier = [identifier stringByAppendingString:self->_testSuffix]; - } - BOOL success = [self->_controller compareSnapshotOfView:self->_view - selector:self->_testSelector - identifier:identifier - error:&error]; - if (!success) { - RCTLogInfo(@"Failed to verify snapshot %@ (error: %@)", identifier, error); - } - callback(@[ @(success) ]); - }]; -} - -RCT_EXPORT_METHOD(sendAppEvent : (NSString *)name body : (nullable id)body) -{ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [[_moduleRegistry moduleForName:"EventDispatcher"] sendAppEventWithName:name body:body]; -#pragma clang diagnostic pop -} - -RCT_REMAP_METHOD( - shouldResolve, - shouldResolve_resolve : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject) -{ - resolve(@1); -} - -RCT_REMAP_METHOD( - shouldReject, - shouldReject_resolve : (RCTPromiseResolveBlock)resolve reject : (RCTPromiseRejectBlock)reject) -{ - reject(nil, nil, nil); -} - -- (void)markTestCompleted -{ - [self markTestPassed:YES]; -} - -- (void)markTestPassed:(BOOL)success -{ - [_viewRegistry_DEPRECATED addUIBlock:^(__unused RCTViewRegistry *viewRegistry) { - self->_status = success ? RCTTestStatusPassed : RCTTestStatusFailed; - }]; -} - -- (std::shared_ptr)getTurboModule: - (const facebook::react::ObjCTurboModule::InitParams &)params -{ - return std::make_shared(params); -} - -@end - -Class RCTTestModuleCls(void) -{ - return RCTTestModule.class; -} diff --git a/packages/rn-tester/RCTTest/RCTTestPlugins.h b/packages/rn-tester/RCTTest/RCTTestPlugins.h deleted file mode 100644 index 755019513d4a..000000000000 --- a/packages/rn-tester/RCTTest/RCTTestPlugins.h +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @generated by an internal plugin build system - */ - -#ifdef RN_DISABLE_OSS_PLUGIN_HEADER - -// FB Internal: FBRCTTestPlugins.h is autogenerated by the build system. -#import - -#else - -// OSS-compatibility layer - -#import - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage" - -#ifdef __cplusplus -extern "C" { -#endif - -// RCTTurboModuleManagerDelegate should call this to resolve module classes. -Class RCTTestClassProvider(const char *name); - -// Lookup functions -Class RCTTestModuleCls(void) __attribute__((used)); - -#ifdef __cplusplus -} -#endif - -#pragma GCC diagnostic pop - -#endif // RN_DISABLE_OSS_PLUGIN_HEADER diff --git a/packages/rn-tester/RCTTest/RCTTestPlugins.mm b/packages/rn-tester/RCTTest/RCTTestPlugins.mm deleted file mode 100644 index aee79a0764bf..000000000000 --- a/packages/rn-tester/RCTTest/RCTTestPlugins.mm +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @generated by an internal plugin build system - */ - -#ifndef RN_DISABLE_OSS_PLUGIN_HEADER - -// OSS-compatibility layer - -#import "RCTTestPlugins.h" - -#import -#import - -Class RCTTestClassProvider(const char *name) { - static std::unordered_map sCoreModuleClassMap = { - {"TestModule", RCTTestModuleCls}, - }; - - auto p = sCoreModuleClassMap.find(name); - if (p != sCoreModuleClassMap.end()) { - auto classFunc = p->second; - return classFunc(); - } - return nil; -} - -#endif // RN_DISABLE_OSS_PLUGIN_HEADER diff --git a/packages/rn-tester/RCTTest/RCTTestRunner.h b/packages/rn-tester/RCTTest/RCTTestRunner.h deleted file mode 100644 index 5fb15bd2e3bc..000000000000 --- a/packages/rn-tester/RCTTest/RCTTestRunner.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#ifndef FB_REFERENCE_IMAGE_DIR -#define FB_REFERENCE_IMAGE_DIR "" -#endif - -#define RCT_RUN_RUNLOOP_WHILE(CONDITION) \ - { \ - NSDate *timeout = [NSDate dateWithTimeIntervalSinceNow:30]; \ - NSRunLoop *runloop = [NSRunLoop mainRunLoop]; \ - while ((CONDITION)) { \ - [runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; \ - if ([timeout timeIntervalSinceNow] <= 0) { \ - XCTFail(@"Runloop timed out before condition was met"); \ - break; \ - } \ - } \ - } - -/** - * Use the RCTInitRunnerForApp macro for typical usage. See FBSnapshotTestCase.h for more information - * on how to configure the snapshotting system. - */ -#define RCTInitRunnerForApp(app__, moduleProvider__, scriptURL__) \ - [[RCTTestRunner alloc] initWithApp:(app__) \ - referenceDirectory:@FB_REFERENCE_IMAGE_DIR \ - moduleProvider:(moduleProvider__)scriptURL:scriptURL__] - -#define RCTInitRunnerForAppWithDelegate(app__, bridgeDelegate__) \ - [[RCTTestRunner alloc] initWithApp:(app__) \ - referenceDirectory:@FB_REFERENCE_IMAGE_DIR \ - bridgeDelegate:(bridgeDelegate__)] - -@protocol RCTBridgeModule; -@class RCTBridge; - -@class RCTRootView; - -@interface RCTTestRunner : NSObject - -/** - * Controls the mode snapshots are run in. If set to true, new snapshots are written to disk, - * otherwise, the UI will be compared to the existing snapshot. - */ -@property (nonatomic, assign) BOOL recordMode; - -@property (nonatomic, assign, readwrite) BOOL useBundler; - -@property (nonatomic, assign, readwrite) BOOL useJSDebugger; - -@property (nonatomic, copy) NSString *testSuffix; - -@property (nonatomic, readonly) NSURL *scriptURL; - -/** - * Initialize a runner. It's recommended that you use the RCTInitRunnerForApp - * macro instead of calling this directly. - * - * @param app The path to the app bundle without suffixes, e.g. IntegrationTests/IntegrationTestsApp - * @param referenceDirectory The path for snapshot references images. - * @param block A block that returns an array of extra modules to be used by the test runner. - * @param scriptURL URL to the JS bundle to use. - * @param bridgeDelegate Custom delegate for bridge activities. - */ -- (instancetype)initWithApp:(NSString *)app - referenceDirectory:(NSString *)referenceDirectory - moduleProvider:(RCTBridgeModuleListProvider)block - scriptURL:(NSURL *)scriptURL - bridgeDelegate:(id)bridgeDelegate NS_DESIGNATED_INITIALIZER; - -- (instancetype)initWithApp:(NSString *)app - referenceDirectory:(NSString *)referenceDirectory - moduleProvider:(RCTBridgeModuleListProvider)block - scriptURL:(NSURL *)scriptURL; - -- (instancetype)initWithApp:(NSString *)app - referenceDirectory:(NSString *)referenceDirectory - bridgeDelegate:(id)bridgeDelegate; - -- (NSURL *)defaultScriptURL; - -/** - * Simplest runTest function simply mounts the specified JS module with no - * initialProps and waits for it to call - * - * RCTTestModule.markTestCompleted() - * - * JS errors/exceptions and timeouts will fail the test. Snapshot tests call - * RCTTestModule.verifySnapshot whenever they want to verify what has been - * rendered (typically via requestAnimationFrame to make sure the latest state - * has been rendered in native. - * - * @param test Selector of the test, usually just `_cmd`. - * @param moduleName Name of the JS component as registered by `AppRegistry.registerComponent` in JS. - */ -- (void)runTest:(SEL)test module:(NSString *)moduleName; - -/** - * Same as runTest:, but allows for passing initialProps for providing mock data - * or requesting different behaviors, configurationBlock provides arbitrary logic for the hosting - * root view manipulation. - * - * @param test Selector of the test, usually just `_cmd`. - * @param moduleName Name of the JS component as registered by `AppRegistry.registerComponent` in JS. - * @param initialProps props that are passed into the component when rendered. - * @param configurationBlock A block that takes the hosting root view and performs arbitrary manipulation after its - * creation. - */ -- (void)runTest:(SEL)test - module:(NSString *)moduleName - initialProps:(NSDictionary *)initialProps - configurationBlock:(void (^)(RCTRootView *rootView))configurationBlock; - -/** - * Same as runTest:, but allows for passing initialProps for providing mock data - * or requesting different behaviors, configurationBlock provides arbitrary logic for the hosting - * root view manipulation, and expectErrorRegex verifies that the error you expected was thrown. - * - * @param test Selector of the test, usually just `_cmd`. - * @param moduleName Name of the JS component as registered by `AppRegistry.registerComponent` in JS. - * @param initialProps props that are passed into the component when rendered. - * @param configurationBlock A block that takes the hosting root view and performs arbitrary manipulation after its - * creation. - * @param expectErrorRegex A regex that must match the error thrown. If no error is thrown, the test fails. - */ -- (void)runTest:(SEL)test - module:(NSString *)moduleName - initialProps:(NSDictionary *)initialProps - configurationBlock:(void (^)(RCTRootView *rootView))configurationBlock - expectErrorRegex:(NSString *)expectErrorRegex; - -/** - * Same as runTest:, but allows for passing initialProps for providing mock data - * or requesting different behaviors, configurationBlock provides arbitrary logic for the hosting - * root view manipulation, and expectErrorBlock provides arbitrary - * logic for processing errors (nil will cause any error to fail the test). - * - * @param test Selector of the test, usually just `_cmd`. - * @param moduleName Name of the JS component as registered by `AppRegistry.registerComponent` in JS. - * @param initialProps props that are passed into the component when rendered. - * @param configurationBlock A block that takes the hosting root view and performs arbitrary manipulation after its - * creation. - * @param expectErrorBlock A block that takes the error message and returns NO to fail the test. - */ -- (void)runTest:(SEL)test - module:(NSString *)moduleName - initialProps:(NSDictionary *)initialProps - configurationBlock:(void (^)(RCTRootView *rootView))configurationBlock - expectErrorBlock:(BOOL (^)(NSString *error))expectErrorBlock; - -@end diff --git a/packages/rn-tester/RCTTest/RCTTestRunner.m b/packages/rn-tester/RCTTest/RCTTestRunner.m deleted file mode 100644 index 0f85e8674caa..000000000000 --- a/packages/rn-tester/RCTTest/RCTTestRunner.m +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTTestRunner.h" - -#import -#import -#import -#import -#import -#import -#import -#import - -#import "FBSnapshotTestController.h" -#import "RCTTestModule.h" - -static const NSTimeInterval kTestTimeoutSeconds = 120; - -@implementation RCTTestRunner { - FBSnapshotTestController *_testController; - RCTBridgeModuleListProvider _moduleProvider; - NSString *_appPath; - __weak id _bridgeDelegate; -} - -- (instancetype)initWithApp:(NSString *)app - referenceDirectory:(NSString *)referenceDirectory - moduleProvider:(RCTBridgeModuleListProvider)block - scriptURL:(NSURL *)scriptURL -{ - return [self initWithApp:app - referenceDirectory:referenceDirectory - moduleProvider:block - scriptURL:scriptURL - bridgeDelegate:nil]; -} - -- (instancetype)initWithApp:(NSString *)app - referenceDirectory:(NSString *)referenceDirectory - bridgeDelegate:(id)bridgeDelegate -{ - return [self initWithApp:app - referenceDirectory:referenceDirectory - moduleProvider:nil - scriptURL:nil - bridgeDelegate:bridgeDelegate]; -} - -- (instancetype)initWithApp:(NSString *)app - referenceDirectory:(NSString *)referenceDirectory - moduleProvider:(RCTBridgeModuleListProvider)block - scriptURL:(NSURL *)scriptURL - bridgeDelegate:(id)bridgeDelegate -{ - RCTAssertParam(app); - RCTAssertParam(referenceDirectory); - - if ((self = [super init])) { - if (!referenceDirectory.length) { - referenceDirectory = - [[NSBundle bundleForClass:self.class].resourcePath stringByAppendingPathComponent:@"ReferenceImages"]; - } - - NSString *sanitizedAppName = [app stringByReplacingOccurrencesOfString:@"/" withString:@"-"]; - sanitizedAppName = [sanitizedAppName stringByReplacingOccurrencesOfString:@"\\" withString:@"-"]; - _testController = [[FBSnapshotTestController alloc] initWithTestName:sanitizedAppName]; - _testController.referenceImagesDirectory = referenceDirectory; - _moduleProvider = [block copy]; - _appPath = app; - _bridgeDelegate = bridgeDelegate; - - if (scriptURL != nil) { - _scriptURL = scriptURL; - } else if (!_bridgeDelegate) { - [self updateScript]; - } - } - return self; -} - -RCT_NOT_IMPLEMENTED(-(instancetype)init) - -- (NSURL *)defaultScriptURL -{ - if (getenv("CI_USE_PACKAGER") || _useBundler) { - return [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@.bundle?platform=%@&dev=true", - _appPath, - RCTPlatformName]]; - } else { - return [[NSBundle bundleForClass:[RCTBridge class]] URLForResource:@"main" withExtension:@"jsbundle"]; - } -} - -- (void)updateScript -{ - _scriptURL = [self defaultScriptURL]; - RCTAssert(_scriptURL != nil, @"No scriptURL set"); -} - -- (void)setRecordMode:(BOOL)recordMode -{ - _testController.recordMode = recordMode; -} - -- (BOOL)recordMode -{ - return _testController.recordMode; -} - -- (void)setUseBundler:(BOOL)useBundler -{ - _useBundler = useBundler; - [self updateScript]; -} - -- (void)runTest:(SEL)test module:(NSString *)moduleName -{ - [self runTest:test module:moduleName initialProps:nil configurationBlock:nil expectErrorBlock:nil]; -} - -- (void)runTest:(SEL)test - module:(NSString *)moduleName - initialProps:(NSDictionary *)initialProps - configurationBlock:(void (^)(RCTRootView *rootView))configurationBlock -{ - [self runTest:test - module:moduleName - initialProps:initialProps - configurationBlock:configurationBlock - expectErrorBlock:nil]; -} - -- (void)runTest:(SEL)test - module:(NSString *)moduleName - initialProps:(NSDictionary *)initialProps - configurationBlock:(void (^)(RCTRootView *rootView))configurationBlock - expectErrorRegex:(NSString *)errorRegex -{ - BOOL (^expectErrorBlock)(NSString *error) = ^BOOL(NSString *error) { - return [error rangeOfString:errorRegex options:NSRegularExpressionSearch].location != NSNotFound; - }; - - [self runTest:test - module:moduleName - initialProps:initialProps - configurationBlock:configurationBlock - expectErrorBlock:expectErrorBlock]; -} - -- (void)runTest:(SEL)test - module:(NSString *)moduleName - initialProps:(NSDictionary *)initialProps - configurationBlock:(void (^)(RCTRootView *rootView))configurationBlock - expectErrorBlock:(BOOL (^)(NSString *error))expectErrorBlock -{ - __weak RCTBridge *batchedBridge; - NSNumber *rootTag; - RCTLogFunction defaultLogFunction = RCTGetLogFunction(); - // Catch all error logs, that are equivalent to redboxes in dev mode. - __block NSMutableArray *errors = nil; - RCTSetLogFunction( - ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { - defaultLogFunction(level, source, fileName, lineNumber, message); - if (level >= RCTLogLevelError) { - if (errors == nil) { - errors = [NSMutableArray new]; - } - [errors addObject:message]; - } - }); - - @autoreleasepool { - RCTBridge *bridge; - if (_bridgeDelegate) { - bridge = [[RCTBridge alloc] initWithDelegate:_bridgeDelegate launchOptions:nil]; - } else { - bridge = [[RCTBridge alloc] initWithBundleURL:_scriptURL moduleProvider:_moduleProvider launchOptions:nil]; - } - batchedBridge = [bridge batchedBridge]; - - UIViewController *vc = RCTKeyWindow().rootViewController; - vc.view = [UIView new]; - - RCTTestModule *testModule = [bridge moduleForClass:[RCTTestModule class]]; - RCTAssert(_testController != nil, @"_testController should not be nil"); - testModule.controller = _testController; - testModule.testSelector = test; - testModule.testSuffix = _testSuffix; - - @autoreleasepool { - // The rootView needs to be deallocated after this @autoreleasepool block exits. - RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge - moduleName:moduleName - initialProperties:initialProps]; - rootView.frame = CGRectMake(0, 0, 320, 2000); // Constant size for testing on multiple devices - - rootTag = rootView.reactTag; - testModule.view = rootView; - - [vc.view addSubview:rootView]; // Add as subview so it doesn't get resized - - if (configurationBlock) { - configurationBlock(rootView); - } - - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:kTestTimeoutSeconds]; - while (date.timeIntervalSinceNow > 0 && testModule.status == RCTTestStatusPending && errors == nil) { - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - } - - [rootView removeFromSuperview]; - testModule.view = nil; - } - - // From this point on catch only fatal errors. - RCTSetLogFunction( - ^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { - defaultLogFunction(level, source, fileName, lineNumber, message); - if (level >= RCTLogLevelFatal) { - if (errors == nil) { - errors = [NSMutableArray new]; - } - [errors addObject:message]; - } - }); - -#if RCT_DEV - NSArray *nonLayoutSubviews = [vc.view.subviews - filteredArrayUsingPredicate:[NSPredicate predicateWithBlock:^BOOL(id subview, NSDictionary *bindings) { - return ![NSStringFromClass([subview class]) isEqualToString:@"_UILayoutGuide"]; - }]]; - - RCTAssert(nonLayoutSubviews.count == 0, @"There shouldn't be any other views: %@", nonLayoutSubviews); -#endif - - if (expectErrorBlock) { - RCTAssert(expectErrorBlock(errors[0]), @"Expected an error but the first one was missing or did not match."); - } else { - RCTAssert(errors == nil, @"RedBox errors: %@", errors); - RCTAssert( - testModule.status != RCTTestStatusPending, @"Test didn't finish within %0.f seconds", kTestTimeoutSeconds); - RCTAssert(testModule.status == RCTTestStatusPassed, @"Test failed"); - } - - // Wait for the rootView to be deallocated completely before invalidating the bridge. - RCTUIManager *uiManager = [bridge moduleForClass:[RCTUIManager class]]; - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:5]; - while (date.timeIntervalSinceNow > 0 && [uiManager viewForReactTag:rootTag]) { - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - } - RCTAssert([uiManager viewForReactTag:rootTag] == nil, @"RootView should have been deallocated after removed."); - - [bridge invalidate]; - } - - // Wait for the bridge to disappear before continuing to the next test. - NSDate *invalidateTimeout = [NSDate dateWithTimeIntervalSinceNow:30]; - while (invalidateTimeout.timeIntervalSinceNow > 0 && batchedBridge != nil) { - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - } - RCTAssert(errors == nil, @"RedBox errors during bridge invalidation: %@", errors); - RCTAssert(batchedBridge == nil, @"Bridge should be deallocated after the test"); - - RCTSetLogFunction(defaultLogFunction); -} - -@end diff --git a/packages/rn-tester/RCTTest/React-RCTTest.podspec b/packages/rn-tester/RCTTest/React-RCTTest.podspec deleted file mode 100644 index e96768635781..000000000000 --- a/packages/rn-tester/RCTTest/React-RCTTest.podspec +++ /dev/null @@ -1,45 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "..", "..", "react-native", "package.json"))) -version = package['version'] - -source = { :git => 'https://github.com/facebook/react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") -else - source[:tag] = "v#{version}" -end - -Pod::Spec.new do |s| - s.name = "React-RCTTest" - s.version = version - s.summary = "Tools for integration and snapshot testing." - s.homepage = "https://reactnative.dev/" - s.license = package["license"] - s.author = "Meta Platforms, Inc. and its affiliates" - s.platforms = min_supported_versions - s.compiler_flags = '-Wno-nullability-completeness' - s.source = source - s.source_files = podspec_sources("**/*.{h,m,mm}", "**/*.h") - s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.framework = "XCTest" - s.header_dir = "RCTTest" - s.pod_target_xcconfig = { - "USE_HEADERMAP" => "YES", - "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(), - } - - s.dependency "React-Core", version - s.dependency "React-CoreModules", version - s.dependency "ReactCommon/turbomodule/core", version - s.dependency "React-jsi", version - - add_rn_third_party_dependencies(s) - add_rncore_dependency(s) -end diff --git a/packages/rn-tester/README.md b/packages/rn-tester/README.md index 47c6cc4508d1..86e21982fc22 100644 --- a/packages/rn-tester/README.md +++ b/packages/rn-tester/README.md @@ -66,7 +66,7 @@ This is different from apps created using `react-native init` which have a depen ## 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`). +RNTester provides unit tests. You can run them all by hitting `Cmd+U` in Xcode. Alternatively, it is possible to run just unit tests using the keybinding after selecting the `RNTesterUnitTests` scheme. ## Visual tests diff --git a/packages/rn-tester/RNTester/RNTester.xctestplan b/packages/rn-tester/RNTester/RNTester.xctestplan index 788bb59c09c2..b2aa9affc5a2 100644 --- a/packages/rn-tester/RNTester/RNTester.xctestplan +++ b/packages/rn-tester/RNTester/RNTester.xctestplan @@ -28,13 +28,6 @@ "undefinedBehaviorSanitizerEnabled" : true }, "testTargets" : [ - { - "target" : { - "containerPath" : "container:RNTesterPods.xcodeproj", - "identifier" : "E7DB215222B2F332005AC45F", - "name" : "RNTesterIntegrationTests" - } - }, { "target" : { "containerPath" : "container:RNTesterPods.xcodeproj", diff --git a/packages/rn-tester/RNTester/SceneDelegate.mm b/packages/rn-tester/RNTester/SceneDelegate.mm index 26c4b217677f..bd9635151caa 100644 --- a/packages/rn-tester/RNTester/SceneDelegate.mm +++ b/packages/rn-tester/RNTester/SceneDelegate.mm @@ -89,11 +89,6 @@ - (void)scene:(UIScene *)scene continueUserActivity:(NSUserActivity *)userActivi [RCTLinkingManager scene:scene continueUserActivity:userActivity]; } -- (NSURL *)sourceURLForBridge:(RCTBridge *)bridge -{ - return [self bundleURL]; -} - - (NSURL *)bundleURL { return [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:kBundlePath]; diff --git a/packages/rn-tester/RNTesterIntegrationTests/Info.plist b/packages/rn-tester/RNTesterIntegrationTests/Info.plist deleted file mode 100644 index 6c40a6cd0c4a..000000000000 --- a/packages/rn-tester/RNTesterIntegrationTests/Info.plist +++ /dev/null @@ -1,22 +0,0 @@ - - - - - CFBundleDevelopmentRegion - $(DEVELOPMENT_LANGUAGE) - CFBundleExecutable - $(EXECUTABLE_NAME) - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - $(PRODUCT_NAME) - CFBundlePackageType - BNDL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - diff --git a/packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m b/packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m deleted file mode 100644 index dd2336c0c220..000000000000 --- a/packages/rn-tester/RNTesterIntegrationTests/RCTLoggingTests.m +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import - -// Time to wait for an expected log statement to show before failing the test -const int64_t LOGGER_TIMEOUT = 10 * NSEC_PER_SEC; - -@interface RCTLoggingTests : XCTestCase - -@end - -@implementation RCTLoggingTests { - RCTBridge *_bridge; - - dispatch_semaphore_t _logSem; - RCTLogLevel _lastLogLevel; - RCTLogSource _lastLogSource; - NSString *_lastLogMessage; -} - -- (void)setUp -{ - XCTSkip(@"Skipping RCTLoggingTests since they rely on deprecated RCTBridge functionality."); - - NSURL *scriptURL; - if (getenv("CI_USE_PACKAGER")) { - NSString *app = @"IntegrationTests/IntegrationTestsApp"; - scriptURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://localhost:8081/%@.bundle?platform=%@&dev=true", - app, - RCTPlatformName]]; - } else { - scriptURL = [[NSBundle bundleForClass:[RCTBridge class]] URLForResource:@"main" withExtension:@"jsbundle"]; - } - RCTAssert(scriptURL != nil, @"No scriptURL set"); - - _bridge = [[RCTBridge alloc] initWithBundleURL:scriptURL moduleProvider:NULL launchOptions:nil]; - NSDate *date = [NSDate dateWithTimeIntervalSinceNow:60]; - while (date.timeIntervalSinceNow > 0 && _bridge.loading) { - [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; - } - XCTAssertFalse(_bridge.loading); - - _logSem = dispatch_semaphore_create(0); - - // Set the log function to signal the semaphore - RCTSetLogFunction( - ^(RCTLogLevel level, - RCTLogSource source, - __unused NSString *fileName, - __unused NSNumber *lineNumber, - NSString *message) { - if (source == RCTLogSourceJavaScript) { - self->_lastLogLevel = level; - self->_lastLogSource = source; - self->_lastLogMessage = message; - dispatch_semaphore_signal(self->_logSem); - } - }); -} - -- (void)tearDown -{ - [_bridge invalidate]; - _bridge = nil; - - RCTSetLogFunction(RCTDefaultLogFunction); -} - -- (void)testLogging -{ - intptr_t waitRet = 0; - - // First queue the marker and spin until it happens to be logged. - // This is to ensure we skip all of the other messages, that were logged earlier. - NSString *const LogMarker = @"===LOG_MARKER==="; - [_bridge enqueueJSCall:@"LoggingTestModule.logToConsole" args:@[ LogMarker ]]; - - do { - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for log marker"); - } while (waitRet == 0 && ![_lastLogMessage isEqualToString:LogMarker]); - - [_bridge enqueueJSCall:@"LoggingTestModule.logToConsole" args:@[ @"Invoking console.log" ]]; - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for logToConsole"); - - XCTAssertEqual(_lastLogLevel, RCTLogLevelInfo); - XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertEqualObjects(_lastLogMessage, @"Invoking console.log"); - - [_bridge enqueueJSCall:@"LoggingTestModule.warning" args:@[ @"Generating warning" ]]; - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for warning"); - - XCTAssertEqual(_lastLogLevel, RCTLogLevelWarning); - XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertEqualObjects(_lastLogMessage, @"Generating warning"); - - [_bridge enqueueJSCall:@"LoggingTestModule.invariant" args:@[ @"Invariant failed" ]]; - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for invariant"); - - XCTAssertEqual(_lastLogLevel, RCTLogLevelError); - XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertTrue([_lastLogMessage containsString:@"Invariant Violation: Invariant failed"]); - - [_bridge enqueueJSCall:@"LoggingTestModule.logErrorToConsole" args:@[ @"Invoking console.error" ]]; - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for logErrorToConsole"); - - // For local bundles, we may first get a warning about symbolication - if (![_lastLogMessage isEqualToString:@"Invoking console.error"]) { - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for logErrorToConsole #2"); - } - - XCTAssertEqual(_lastLogLevel, RCTLogLevelError); - XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertEqualObjects(_lastLogMessage, @"Invoking console.error"); - - [_bridge enqueueJSCall:@"LoggingTestModule.throwError" args:@[ @"Throwing an error" ]]; - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for throwError"); - - // For local bundles, we may first get a warning about symbolication - if (![_lastLogMessage containsString:@"Error: Throwing an error"]) { - waitRet = dispatch_semaphore_wait(_logSem, dispatch_time(DISPATCH_TIME_NOW, LOGGER_TIMEOUT)); - XCTAssertEqual(waitRet, 0, @"Timed out waiting for throwError #2"); - } - - XCTAssertEqual(_lastLogLevel, RCTLogLevelError); - XCTAssertEqual(_lastLogSource, RCTLogSourceJavaScript); - XCTAssertTrue([_lastLogMessage containsString:@"Error: Throwing an error"]); -} - -@end diff --git a/packages/rn-tester/RNTesterIntegrationTests/RNTesterIntegrationTests.m b/packages/rn-tester/RNTesterIntegrationTests/RNTesterIntegrationTests.m deleted file mode 100644 index b38476d53dbc..000000000000 --- a/packages/rn-tester/RNTesterIntegrationTests/RNTesterIntegrationTests.m +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#import - -#define RCT_TEST(name) \ - -(void)test##name \ - { \ - [_runner runTest:_cmd module:@ #name]; \ - } - -#define RCT_TEST_ONLY_WITH_PACKAGER(name) \ - -(void)test##name \ - { \ - if (getenv("CI_USE_PACKAGER")) { \ - [_runner runTest:_cmd module:@ #name]; \ - } \ - } - -@interface RNTesterIntegrationTests : XCTestCase - -@end - -@implementation RNTesterIntegrationTests { - RCTTestRunner *_runner; -} - -- (void)setUp -{ - _runner = RCTInitRunnerForApp(@"IntegrationTests/IntegrationTestsApp", nil, nil); - _runner.recordMode = NO; -} - -#pragma mark - Test harness - -// Disabled due to test being based on deprecated RCTBridge -- (void)disabled_testTheTester_waitOneFrame -{ - [_runner runTest:_cmd - module:@"IntegrationTestHarnessTest" - initialProps:@{@"waitOneFrame" : @YES} - configurationBlock:nil]; -} - -// Disabled -//- (void)testTheTester_ExpectError -//{ -// [_runner runTest:_cmd -// module:@"IntegrationTestHarnessTest" -// initialProps:@{@"shouldThrow": @YES} -// configurationBlock:nil -// expectErrorRegex:@"because shouldThrow"]; -//} - -#pragma mark - JS tests - -// This list should be kept in sync with IntegrationTestsApp.js -// 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) // Disabled due to test being based on deprecated RCTBridge -// RCT_TEST(ImageCachePolicyTest) // This test never passed. -// RCT_TEST(ImageSnapshotTest) // Disabled due to test being based on deprecated RCTBridge -// RCT_TEST(LayoutEventsTest) // Disabled due to flakiness: #8686784 -// 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 - -// RCT_TEST(GlobalEvalWithSourceUrlTest) // Disabled due to test being based on deprecated RCTBridge - -@end diff --git a/packages/rn-tester/RNTesterIntegrationTests/RNTesterTestModule.m b/packages/rn-tester/RNTesterIntegrationTests/RNTesterTestModule.m deleted file mode 100644 index 119a34458c16..000000000000 --- a/packages/rn-tester/RNTesterIntegrationTests/RNTesterTestModule.m +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface RNTesterTestModule : NSObject - -@end - -@implementation RNTesterTestModule - -RCT_EXPORT_MODULE(RNTesterTestModule) - -RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(echoString : (NSString *)input) -{ - return input; -} - -RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(methodThatReturnsNil) -{ - return nil; -} - -RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD( - methodThatCallsCallbackWithString : (NSString *)input callback : (RCTResponseSenderBlock)callback) -{ - callback(@[ input ]); - return nil; -} - -@end diff --git a/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testImageSnapshotTest_1@2x.png b/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testImageSnapshotTest_1@2x.png deleted file mode 100644 index adf8f217a5dd..000000000000 Binary files a/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testImageSnapshotTest_1@2x.png and /dev/null differ diff --git a/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testImageSnapshotTest_1@3x.png b/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testImageSnapshotTest_1@3x.png deleted file mode 100644 index c12d1644e280..000000000000 Binary files a/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testImageSnapshotTest_1@3x.png and /dev/null differ diff --git a/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testSimpleSnapshotTest_1@2x.png b/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testSimpleSnapshotTest_1@2x.png deleted file mode 100644 index fd91abf4238e..000000000000 Binary files a/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testSimpleSnapshotTest_1@2x.png and /dev/null differ diff --git a/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testSimpleSnapshotTest_1@3x.png b/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testSimpleSnapshotTest_1@3x.png deleted file mode 100644 index a7f45cd033c1..000000000000 Binary files a/packages/rn-tester/RNTesterIntegrationTests/ReferenceImages/IntegrationTests-IntegrationTestsApp/testSimpleSnapshotTest_1@3x.png and /dev/null differ diff --git a/packages/rn-tester/RNTesterIntegrationTests/blue_square.png b/packages/rn-tester/RNTesterIntegrationTests/blue_square.png deleted file mode 100644 index 4974e084c636..000000000000 Binary files a/packages/rn-tester/RNTesterIntegrationTests/blue_square.png and /dev/null differ diff --git a/packages/rn-tester/RNTesterIntegrationTests/red_square.png b/packages/rn-tester/RNTesterIntegrationTests/red_square.png deleted file mode 100644 index 0977a3e8cf33..000000000000 Binary files a/packages/rn-tester/RNTesterIntegrationTests/red_square.png and /dev/null differ diff --git a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj index 1d336b424136..39dceb0ee86c 100644 --- a/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj +++ b/packages/rn-tester/RNTesterPods.xcodeproj/project.pbxproj @@ -12,7 +12,6 @@ 2DDEF0101F84BF7B00DBDF73 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */; }; 383889DA23A7398900D06C3E /* RCTConvert_UIColorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 383889D923A7398900D06C3E /* RCTConvert_UIColorTests.m */; }; 3D2AFAF51D646CF80089D1A3 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; }; - 3F4D148C63BBF774A25488A6 /* libPods-RNTesterIntegrationTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 93A243F0D4D5C54911E811C4 /* libPods-RNTesterIntegrationTests.a */; }; 46C0FD761B0B9B1E8662B759 /* libPods-RNTesterUnitTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 2B312B0EEE90BA411618B015 /* libPods-RNTesterUnitTests.a */; }; 5C60EB1C226440DB0018C04F /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C60EB1B226440DB0018C04F /* AppDelegate.mm */; }; 602160B9478DAFF2BAB56595 /* RCTUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = D5D13FB1445C5C19639921CC /* RCTUtilsTests.m */; }; @@ -24,7 +23,6 @@ CD10C7A5290BD4EB0033E1ED /* RCTEventEmitterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CD10C7A4290BD4EB0033E1ED /* RCTEventEmitterTests.m */; }; E62F11832A5C6580000BF1C8 /* FlexibleSizeExampleView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.mm */; }; E62F11842A5C6584000BF1C8 /* UpdatePropertiesExampleView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.mm */; }; - E7C1241A22BEC44B00DA25C0 /* RNTesterIntegrationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */; }; E7DB20D122B2BAA6005AC45F /* RCTBundleURLProviderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20A922B2BAA3005AC45F /* RCTBundleURLProviderTests.m */; }; E7DB20D322B2BAA6005AC45F /* RCTBlobManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AB22B2BAA3005AC45F /* RCTBlobManagerTests.m */; }; E7DB20D522B2BAA6005AC45F /* RCTPerformanceLoggerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20AD22B2BAA3005AC45F /* RCTPerformanceLoggerTests.m */; }; @@ -39,17 +37,13 @@ E7DB20E222B2BAA6005AC45F /* RCTGzipTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C522B2BAA4005AC45F /* RCTGzipTests.m */; }; E7DB20E322B2BAA6005AC45F /* RCTAllocationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C622B2BAA5005AC45F /* RCTAllocationTests.m */; }; E7DB20E422B2BAA6005AC45F /* RCTFormatErrorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C722B2BAA5005AC45F /* RCTFormatErrorTests.m */; }; - E7DB20E522B2BAA6005AC45F /* RCTDevMenuTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C822B2BAA5005AC45F /* RCTDevMenuTests.m */; }; - E7DB20E622B2BAA6005AC45F /* RCTImageLoaderHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20C922B2BAA5005AC45F /* RCTImageLoaderHelpers.m */; }; E7DB20E722B2BAA6005AC45F /* RCTConvert_NSURLTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CA22B2BAA5005AC45F /* RCTConvert_NSURLTests.m */; }; E7DB20E822B2BAA6005AC45F /* RCTModuleMethodTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CB22B2BAA5005AC45F /* RCTModuleMethodTests.mm */; }; - E7DB20E922B2BAA6005AC45F /* RCTComponentPropsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CC22B2BAA5005AC45F /* RCTComponentPropsTests.m */; }; E7DB20EA22B2BAA6005AC45F /* RCTImageUtilTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CD22B2BAA5005AC45F /* RCTImageUtilTests.m */; }; E7DB20EB22B2BAA6005AC45F /* RCTConvert_YGValueTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CE22B2BAA5005AC45F /* RCTConvert_YGValueTests.m */; }; E7DB20EC22B2BAA6005AC45F /* RCTMultipartStreamReaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20CF22B2BAA5005AC45F /* RCTMultipartStreamReaderTests.m */; }; E7DB20ED22B2BAA6005AC45F /* RCTURLUtilsTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB20D022B2BAA5005AC45F /* RCTURLUtilsTests.m */; }; E7DB213122B2C649005AC45F /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7DB213022B2C649005AC45F /* JavaScriptCore.framework */; }; - E7DB216222B2F3EC005AC45F /* RNTesterTestModule.m in Sources */ = {isa = PBXBuildFile; fileRef = E7DB215D22B2F3EC005AC45F /* RNTesterTestModule.m */; }; E7DB216722B2F69F005AC45F /* JavaScriptCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7DB213022B2C649005AC45F /* JavaScriptCore.framework */; }; E7DB218C22B41FCD005AC45F /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E7DB218B22B41FCD005AC45F /* XCTest.framework */; }; F0D621C32BBB9E38005960AC /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = F0D621C22BBB9E38005960AC /* PrivacyInfo.xcprivacy */; }; @@ -81,7 +75,6 @@ 13B07FAF1A68108700A75B9A /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = RNTester/AppDelegate.h; sourceTree = ""; }; 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RNTester/Info.plist; sourceTree = ""; }; 13B07FB71A68108700A75B9A /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = RNTester/main.m; sourceTree = ""; }; - 20B55D3C33B683598D2A4424 /* Pods-RNTesterIntegrationTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.debug.xcconfig"; path = "Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.debug.xcconfig"; sourceTree = ""; }; 272E6B3B1BEA849E001FCF37 /* UpdatePropertiesExampleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UpdatePropertiesExampleView.h; path = RNTester/NativeExampleViews/UpdatePropertiesExampleView.h; sourceTree = ""; }; 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = UpdatePropertiesExampleView.mm; path = RNTester/NativeExampleViews/UpdatePropertiesExampleView.mm; sourceTree = ""; }; 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = FlexibleSizeExampleView.mm; path = RNTester/NativeExampleViews/FlexibleSizeExampleView.mm; sourceTree = ""; }; @@ -98,22 +91,18 @@ 79B29C2D2E607A99007612A5 /* SceneDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = SceneDelegate.mm; path = RNTester/SceneDelegate.mm; sourceTree = ""; }; 8145AE05241172D900A3F8DA /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = RNTester/LaunchScreen.storyboard; sourceTree = ""; }; 832F45BA2A8A6E1F0097B4E6 /* SwiftTest.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SwiftTest.swift; path = RNTester/SwiftTest.swift; sourceTree = ""; }; - 93A243F0D4D5C54911E811C4 /* libPods-RNTesterIntegrationTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-RNTesterIntegrationTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; A975CA6B2C05EADE0043F72A /* RCTNetworkTaskTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RCTNetworkTaskTests.m; sourceTree = ""; }; AC474BFB29BBD4A1002BDAED /* RNTester.xctestplan */ = {isa = PBXFileReference; lastKnownFileType = text; name = RNTester.xctestplan; path = RNTester/RNTester.xctestplan; sourceTree = ""; }; - B0E70A8A05E03E868F8703FE /* Pods-RNTesterIntegrationTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterIntegrationTests.release.xcconfig"; path = "Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests.release.xcconfig"; sourceTree = ""; }; CA59C9994B1822826D8983F0 /* Pods-RNTester.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTester.debug.xcconfig"; path = "Target Support Files/Pods-RNTester/Pods-RNTester.debug.xcconfig"; sourceTree = ""; }; CD10C7A4290BD4EB0033E1ED /* RCTEventEmitterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTEventEmitterTests.m; sourceTree = ""; }; D134EB89DD98253FCF879A47 /* Pods-RNTesterUnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNTesterUnitTests.debug.xcconfig"; path = "Target Support Files/Pods-RNTesterUnitTests/Pods-RNTesterUnitTests.debug.xcconfig"; sourceTree = ""; }; D5D13FB1445C5C19639921CC /* RCTUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTUtilsTests.m; sourceTree = ""; }; E771AEEA22B44E3100EA1189 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = RNTester/Info.plist; sourceTree = ""; }; - E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterIntegrationTests.m; sourceTree = ""; }; E7DB209F22B2BA84005AC45F /* RNTesterUnitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterUnitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; E7DB20A322B2BA84005AC45F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; E7DB20A922B2BAA3005AC45F /* RCTBundleURLProviderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBundleURLProviderTests.m; sourceTree = ""; }; E7DB20AB22B2BAA3005AC45F /* RCTBlobManagerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTBlobManagerTests.m; sourceTree = ""; }; E7DB20AD22B2BAA3005AC45F /* RCTPerformanceLoggerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTPerformanceLoggerTests.m; sourceTree = ""; }; - E7DB20AE22B2BAA4005AC45F /* RCTImageLoaderHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RCTImageLoaderHelpers.h; sourceTree = ""; }; E7DB20AF22B2BAA4005AC45F /* RCTFontTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFontTests.m; sourceTree = ""; }; E7DB20B122B2BAA4005AC45F /* RCTJSONTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTJSONTests.m; sourceTree = ""; }; E7DB20B222B2BAA4005AC45F /* RCTAnimationUtilsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAnimationUtilsTests.m; sourceTree = ""; }; @@ -125,11 +114,8 @@ E7DB20C522B2BAA4005AC45F /* RCTGzipTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTGzipTests.m; sourceTree = ""; }; E7DB20C622B2BAA5005AC45F /* RCTAllocationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTAllocationTests.m; sourceTree = ""; }; E7DB20C722B2BAA5005AC45F /* RCTFormatErrorTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTFormatErrorTests.m; sourceTree = ""; }; - E7DB20C822B2BAA5005AC45F /* RCTDevMenuTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTDevMenuTests.m; sourceTree = ""; }; - E7DB20C922B2BAA5005AC45F /* RCTImageLoaderHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageLoaderHelpers.m; sourceTree = ""; }; E7DB20CA22B2BAA5005AC45F /* RCTConvert_NSURLTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_NSURLTests.m; sourceTree = ""; }; E7DB20CB22B2BAA5005AC45F /* RCTModuleMethodTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTModuleMethodTests.mm; sourceTree = ""; }; - E7DB20CC22B2BAA5005AC45F /* RCTComponentPropsTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTComponentPropsTests.m; sourceTree = ""; }; E7DB20CD22B2BAA5005AC45F /* RCTImageUtilTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTImageUtilTests.m; sourceTree = ""; }; E7DB20CE22B2BAA5005AC45F /* RCTConvert_YGValueTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTConvert_YGValueTests.m; sourceTree = ""; }; E7DB20CF22B2BAA5005AC45F /* RCTMultipartStreamReaderTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RCTMultipartStreamReaderTests.m; sourceTree = ""; }; @@ -155,9 +141,7 @@ E7DB211A22B2BD53005AC45F /* libReact-RCTVibration.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = "libReact-RCTVibration.a"; sourceTree = BUILT_PRODUCTS_DIR; }; E7DB212222B2BD53005AC45F /* libyoga.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; path = libyoga.a; sourceTree = BUILT_PRODUCTS_DIR; }; E7DB213022B2C649005AC45F /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; - E7DB215322B2F332005AC45F /* RNTesterIntegrationTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNTesterIntegrationTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; E7DB215722B2F332005AC45F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - E7DB215D22B2F3EC005AC45F /* RNTesterTestModule.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNTesterTestModule.m; sourceTree = ""; }; E7DB218B22B41FCD005AC45F /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = XCTest.framework; sourceTree = DEVELOPER_DIR; }; F0D621C22BBB9E38005960AC /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; F1A0B1C23D4E5F6071829301 /* RCTTurboModuleArrayBufferTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RCTTurboModuleArrayBufferTests.mm; sourceTree = ""; }; @@ -183,16 +167,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - E7DB215022B2F332005AC45F /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - E7DB218C22B41FCD005AC45F /* XCTest.framework in Frameworks */, - E7DB216722B2F69F005AC45F /* JavaScriptCore.framework in Frameworks */, - 3F4D148C63BBF774A25488A6 /* libPods-RNTesterIntegrationTests.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ @@ -263,7 +237,6 @@ E7DB211A22B2BD53005AC45F /* libReact-RCTVibration.a */, E7DB212222B2BD53005AC45F /* libyoga.a */, 4C706D402EE4AF9BE838CBA9 /* libPods-RNTester.a */, - 93A243F0D4D5C54911E811C4 /* libPods-RNTesterIntegrationTests.a */, 2B312B0EEE90BA411618B015 /* libPods-RNTesterUnitTests.a */, ); name = Frameworks; @@ -282,7 +255,6 @@ 0EA618022BE537D3001875EF /* RNTesterBundle.bundle */, 13B07FAE1A68108700A75B9A /* RNTester */, E7DB20A022B2BA84005AC45F /* RNTesterUnitTests */, - E7DB215422B2F332005AC45F /* RNTesterIntegrationTests */, 83CBBA001A601CBA00E9B192 /* Products */, 2DE7E7D81FB2A4F3009E225D /* Frameworks */, E23BD6487B06BD71F1A86914 /* Pods */, @@ -297,7 +269,6 @@ children = ( 13B07F961A680F5B00A75B9A /* RNTester.app */, E7DB209F22B2BA84005AC45F /* RNTesterUnitTests.xctest */, - E7DB215322B2F332005AC45F /* RNTesterIntegrationTests.xctest */, ); name = Products; sourceTree = ""; @@ -307,8 +278,6 @@ children = ( CA59C9994B1822826D8983F0 /* Pods-RNTester.debug.xcconfig */, 51BC9297B6C3163C14532020 /* Pods-RNTester.release.xcconfig */, - 20B55D3C33B683598D2A4424 /* Pods-RNTesterIntegrationTests.debug.xcconfig */, - B0E70A8A05E03E868F8703FE /* Pods-RNTesterIntegrationTests.release.xcconfig */, D134EB89DD98253FCF879A47 /* Pods-RNTesterUnitTests.debug.xcconfig */, 3FF60722627F93D8F62FA1E3 /* Pods-RNTesterUnitTests.release.xcconfig */, ); @@ -324,17 +293,13 @@ E7DB20B222B2BAA4005AC45F /* RCTAnimationUtilsTests.m */, E7DB20AB22B2BAA3005AC45F /* RCTBlobManagerTests.m */, E7DB20A922B2BAA3005AC45F /* RCTBundleURLProviderTests.m */, - E7DB20CC22B2BAA5005AC45F /* RCTComponentPropsTests.m */, E7DB20CA22B2BAA5005AC45F /* RCTConvert_NSURLTests.m */, E7DB20CE22B2BAA5005AC45F /* RCTConvert_YGValueTests.m */, 383889D923A7398900D06C3E /* RCTConvert_UIColorTests.m */, D1A60AD11B9247A080734F01 /* RCTDevLoadingViewTests.m */, - E7DB20C822B2BAA5005AC45F /* RCTDevMenuTests.m */, E7DB20AF22B2BAA4005AC45F /* RCTFontTests.m */, E7DB20C722B2BAA5005AC45F /* RCTFormatErrorTests.m */, E7DB20C522B2BAA4005AC45F /* RCTGzipTests.m */, - E7DB20AE22B2BAA4005AC45F /* RCTImageLoaderHelpers.h */, - E7DB20C922B2BAA5005AC45F /* RCTImageLoaderHelpers.m */, E7DB20C222B2BAA4005AC45F /* RCTImageLoaderTests.m */, E7DB20CD22B2BAA5005AC45F /* RCTImageUtilTests.m */, E7DB20B122B2BAA4005AC45F /* RCTJSONTests.m */, @@ -354,16 +319,6 @@ path = RNTesterUnitTests; sourceTree = ""; }; - E7DB215422B2F332005AC45F /* RNTesterIntegrationTests */ = { - isa = PBXGroup; - children = ( - E7C1241922BEC44B00DA25C0 /* RNTesterIntegrationTests.m */, - E7DB215D22B2F3EC005AC45F /* RNTesterTestModule.m */, - E7DB215722B2F332005AC45F /* Info.plist */, - ); - path = RNTesterIntegrationTests; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -410,27 +365,6 @@ productReference = E7DB209F22B2BA84005AC45F /* RNTesterUnitTests.xctest */; productType = "com.apple.product-type.bundle.unit-test"; }; - E7DB215222B2F332005AC45F /* RNTesterIntegrationTests */ = { - isa = PBXNativeTarget; - buildConfigurationList = E7DB215A22B2F332005AC45F /* Build configuration list for PBXNativeTarget "RNTesterIntegrationTests" */; - buildPhases = ( - 2978D2EE0533828E5DB62B8F /* [CP] Check Pods Manifest.lock */, - E7DB214F22B2F332005AC45F /* Sources */, - E7DB215022B2F332005AC45F /* Frameworks */, - E7DB215122B2F332005AC45F /* Resources */, - A27E74B2EEF82EC119BCB5A2 /* [CP] Embed Pods Frameworks */, - 48BF6B9FD13CB20F2C71C2A2 /* [CP] Copy Pods Resources */, - ); - buildRules = ( - ); - dependencies = ( - E7DB215922B2F332005AC45F /* PBXTargetDependency */, - ); - name = RNTesterIntegrationTests; - productName = RNTesterIntegrationTests; - productReference = E7DB215322B2F332005AC45F /* RNTesterIntegrationTests.xctest */; - productType = "com.apple.product-type.bundle.unit-test"; - }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ @@ -446,10 +380,6 @@ E7DB209E22B2BA84005AC45F = { CreatedOnToolsVersion = 10.2.1; }; - E7DB215222B2F332005AC45F = { - CreatedOnToolsVersion = 10.2.1; - TestTargetID = 13B07F861A680F5B00A75B9A; - }; }; }; buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "RNTesterPods" */; @@ -467,7 +397,6 @@ targets = ( 13B07F861A680F5B00A75B9A /* RNTester */, E7DB209E22B2BA84005AC45F /* RNTesterUnitTests */, - E7DB215222B2F332005AC45F /* RNTesterIntegrationTests */, ); }; /* End PBXProject section */ @@ -493,13 +422,6 @@ ); runOnlyForDeploymentPostprocessing = 0; }; - E7DB215122B2F332005AC45F /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXResourcesBuildPhase section */ /* Begin PBXShellScriptBuildPhase section */ @@ -524,49 +446,6 @@ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTester/Pods-RNTester-frameworks.sh\"\n"; showEnvVarsInLog = 0; }; - 2978D2EE0533828E5DB62B8F /* [CP] Check Pods Manifest.lock */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - ); - inputPaths = ( - "${PODS_PODFILE_DIR_PATH}/Podfile.lock", - "${PODS_ROOT}/Manifest.lock", - ); - name = "[CP] Check Pods Manifest.lock"; - outputFileListPaths = ( - ); - outputPaths = ( - "$(DERIVED_FILE_DIR)/Pods-RNTesterIntegrationTests-checkManifestLockResult.txt", - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; - showEnvVarsInLog = 0; - }; - 48BF6B9FD13CB20F2C71C2A2 /* [CP] Copy Pods Resources */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-resources-${CONFIGURATION}-input-files.xcfilelist", - ); - inputPaths = ( - ); - name = "[CP] Copy Pods Resources"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-resources-${CONFIGURATION}-output-files.xcfilelist", - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-resources.sh\"\n"; - showEnvVarsInLog = 0; - }; 5ECFFC3767E171859C7610A6 /* [CP] Copy Pods Resources */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -622,27 +501,6 @@ shellPath = /bin/sh; shellScript = ". ../react-native/sdks/hermes-engine/utils/copy-hermes-xcode.sh\n"; }; - A27E74B2EEF82EC119BCB5A2 /* [CP] Embed Pods Frameworks */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks-${CONFIGURATION}-input-files.xcfilelist", - ); - inputPaths = ( - ); - name = "[CP] Embed Pods Frameworks"; - outputFileListPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks-${CONFIGURATION}-output-files.xcfilelist", - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-RNTesterIntegrationTests/Pods-RNTesterIntegrationTests-frameworks.sh\"\n"; - showEnvVarsInLog = 0; - }; B8A88048D4E22316B9E74600 /* [CP] Check Pods Manifest.lock */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -764,32 +622,20 @@ E7DB20D322B2BAA6005AC45F /* RCTBlobManagerTests.m in Sources */, E7DB20E322B2BAA6005AC45F /* RCTAllocationTests.m in Sources */, 383889DA23A7398900D06C3E /* RCTConvert_UIColorTests.m in Sources */, - E7DB20E622B2BAA6005AC45F /* RCTImageLoaderHelpers.m in Sources */, E7DB20D622B2BAA6005AC45F /* RCTFontTests.m in Sources */, E7DB20DB22B2BAA6005AC45F /* RCTNativeAnimatedNodesManagerTests.m in Sources */, E7DB20E722B2BAA6005AC45F /* RCTConvert_NSURLTests.m in Sources */, E7DB20EA22B2BAA6005AC45F /* RCTImageUtilTests.m in Sources */, D1A60AD11B9247A080734F02 /* RCTDevLoadingViewTests.m in Sources */, - E7DB20E522B2BAA6005AC45F /* RCTDevMenuTests.m in Sources */, E7DB20DE22B2BAA6005AC45F /* RCTUnicodeDecodeTests.m in Sources */, CD10C7A5290BD4EB0033E1ED /* RCTEventEmitterTests.m in Sources */, E7DB20E422B2BAA6005AC45F /* RCTFormatErrorTests.m in Sources */, E7DB20EB22B2BAA6005AC45F /* RCTConvert_YGValueTests.m in Sources */, - E7DB20E922B2BAA6005AC45F /* RCTComponentPropsTests.m in Sources */, E7DB20D822B2BAA6005AC45F /* RCTJSONTests.m in Sources */, 602160B9478DAFF2BAB56595 /* RCTUtilsTests.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; - E7DB214F22B2F332005AC45F /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - E7DB216222B2F3EC005AC45F /* RNTesterTestModule.m in Sources */, - E7C1241A22BEC44B00DA25C0 /* RNTesterIntegrationTests.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; /* End PBXSourcesBuildPhase section */ /* Begin PBXTargetDependency section */ @@ -1151,80 +997,6 @@ }; name = Release; }; - E7DB215B22B2F332005AC45F /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = 20B55D3C33B683598D2A4424 /* Pods-RNTesterIntegrationTests.debug.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "iPhone Developer"; - DEBUG_INFORMATION_FORMAT = dwarf; - DEVELOPMENT_TEAM = ""; - GCC_PREPROCESSOR_DEFINITIONS = ( - "FB_REFERENCE_IMAGE_DIR=\"\\\"$(SOURCE_ROOT)/RNTesterIntegrationTests/ReferenceImages\\\"\"", - "$(inherited)", - ); - HEADER_SEARCH_PATHS = ( - "${PODS_ROOT}/Headers/Private/Yoga", - "$(inherited)", - ); - INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 15.1; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - OTHER_CFLAGS = "$(inherited)"; - OTHER_SWIFT_FLAGS = "$(inherited)"; - PRODUCT_BUNDLE_IDENTIFIER = com.meta.RNTesterIntegrationTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester.app/RNTester"; - }; - name = Debug; - }; - E7DB215C22B2F332005AC45F /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = B0E70A8A05E03E868F8703FE /* Pods-RNTesterIntegrationTests.release.xcconfig */; - buildSettings = { - ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - BUNDLE_LOADER = "$(TEST_HOST)"; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEVELOPMENT_TEAM = ""; - HEADER_SEARCH_PATHS = ( - "${PODS_ROOT}/Headers/Private/Yoga", - "$(inherited)", - ); - INFOPLIST_FILE = RNTesterIntegrationTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 15.1; - LD_RUNPATH_SEARCH_PATHS = ( - "$(inherited)", - "@executable_path/Frameworks", - "@loader_path/Frameworks", - ); - MTL_FAST_MATH = YES; - OTHER_CFLAGS = "$(inherited)"; - OTHER_SWIFT_FLAGS = "$(inherited)"; - PRODUCT_BUNDLE_IDENTIFIER = com.meta.RNTesterIntegrationTests; - PRODUCT_NAME = "$(TARGET_NAME)"; - TARGETED_DEVICE_FAMILY = "1,2"; - TEST_HOST = "$(BUILT_PRODUCTS_DIR)/RNTester.app/RNTester"; - }; - name = Release; - }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -1255,15 +1027,6 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; - E7DB215A22B2F332005AC45F /* Build configuration list for PBXNativeTarget "RNTesterIntegrationTests" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - E7DB215B22B2F332005AC45F /* Debug */, - E7DB215C22B2F332005AC45F /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; /* End XCConfigurationList section */ }; rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; diff --git a/packages/rn-tester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterIntegrationTests.xcscheme b/packages/rn-tester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterIntegrationTests.xcscheme deleted file mode 100644 index b45cce49812b..000000000000 --- a/packages/rn-tester/RNTesterPods.xcodeproj/xcshareddata/xcschemes/RNTesterIntegrationTests.xcscheme +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m b/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m index b5b3b8411c4a..b15df99b7b92 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTAllocationTests.m @@ -8,11 +8,23 @@ #import #import -#import #import #import #import +#define RCT_RUN_RUNLOOP_WHILE(CONDITION) \ + { \ + NSDate *timeout = [NSDate dateWithTimeIntervalSinceNow:30]; \ + NSRunLoop *runloop = [NSRunLoop mainRunLoop]; \ + while ((CONDITION)) { \ + [runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; \ + if ([timeout timeIntervalSinceNow] <= 0) { \ + XCTFail(@"Runloop timed out before condition was met"); \ + break; \ + } \ + } \ + } + @interface AllocationTestModule : NSObject @property (atomic, assign, getter=isValid) BOOL valid; diff --git a/packages/rn-tester/RNTesterUnitTests/RCTBlobManagerTests.m b/packages/rn-tester/RNTesterUnitTests/RCTBlobManagerTests.m index 4754b1e3bea5..c7ea22437b5f 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTBlobManagerTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTBlobManagerTests.m @@ -27,7 +27,6 @@ - (void)setUp [super setUp]; _module = [RCTBlobManager new]; - [_module setValue:nil forKey:@"bridge"]; [_module initialize]; NSInteger size = 120; _data = [NSMutableData dataWithCapacity:size]; diff --git a/packages/rn-tester/RNTesterUnitTests/RCTComponentPropsTests.m b/packages/rn-tester/RNTesterUnitTests/RCTComponentPropsTests.m deleted file mode 100644 index bbe70ee8d966..000000000000 --- a/packages/rn-tester/RNTesterUnitTests/RCTComponentPropsTests.m +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import -#import -#import - -@interface RCTUIManager () - -- (void)createView:(NSNumber *)reactTag - viewName:(NSString *)viewName - rootTag:(NSNumber *)rootTag - props:(NSDictionary *)props; - -- (void)updateView:(nonnull NSNumber *)reactTag viewName:(NSString *)viewName props:(NSDictionary *)props; - -@property (nonatomic, copy, readonly) NSMutableDictionary *shadowViewRegistry; - -@end - -@interface RCTPropsTestView : UIView - -@property (nonatomic, assign) NSInteger integerProp; -@property (nonatomic, strong) id objectProp; -@property (nonatomic, assign) CGPoint structProp; -@property (nonatomic, copy) NSString *customProp; - -@end - -@implementation RCTPropsTestView -@end - -@interface RCTPropsTestViewManager : RCTViewManager -@end - -@implementation RCTPropsTestViewManager - -RCT_EXPORT_MODULE() - -- (UIView *)view -{ - RCTPropsTestView *view = [RCTPropsTestView new]; - view.integerProp = 57; - view.objectProp = @9; - view.structProp = CGPointMake(5, 6); - view.customProp = @"Hello"; - return view; -} - -RCT_EXPORT_VIEW_PROPERTY(integerProp, NSInteger) -RCT_EXPORT_VIEW_PROPERTY(objectProp, NSNumber) -RCT_EXPORT_VIEW_PROPERTY(structProp, CGPoint) -RCT_CUSTOM_VIEW_PROPERTY(customProp, NSString, RCTPropsTestView) -{ - view.customProp = json ? [RCTConvert NSString:json] : defaultView.customProp; -} - -@end - -@interface RCTComponentPropsTests : XCTestCase - -@end - -@implementation RCTComponentPropsTests { - RCTBridge *_bridge; - NSNumber *_rootViewReactTag; -} - -- (void)setUp -{ - [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 - launchOptions:nil]; - - _rootViewReactTag = @1; - RCTUIManager *uiManager = _bridge.uiManager; - - dispatch_async(uiManager.methodQueue, ^{ - RCTShadowView *rootShadowView = [RCTShadowView new]; - rootShadowView.reactTag = self->_rootViewReactTag; - uiManager.shadowViewRegistry[rootShadowView.reactTag] = rootShadowView; - }); - - RCT_RUN_RUNLOOP_WHILE(_bridge.isLoading); -} - -- (void)testSetProps -{ - __block RCTPropsTestView *view; - RCTUIManager *uiManager = _bridge.uiManager; - NSDictionary *props = - @{@"integerProp" : @58, @"objectProp" : @10, @"structProp" : @{@"x" : @7, @"y" : @8}, @"customProp" : @"Goodbye"}; - - dispatch_async(uiManager.methodQueue, ^{ - [uiManager createView:@2 viewName:@"RCTPropsTestView" rootTag:self->_rootViewReactTag props:props]; - [uiManager addUIBlock:^(__unused RCTUIManager *_uiManager, NSDictionary *viewRegistry) { - view = (RCTPropsTestView *)viewRegistry[@2]; - XCTAssertEqual(view.integerProp, 58); - XCTAssertEqualObjects(view.objectProp, @10); - XCTAssertTrue(CGPointEqualToPoint(view.structProp, CGPointMake(7, 8))); - XCTAssertEqualObjects(view.customProp, @"Goodbye"); - }]; - [uiManager setNeedsLayout]; - }); - - RCT_RUN_RUNLOOP_WHILE(view == nil); -} - -- (void)testNeedsOffscreenAlphaCompositing -{ - __block RCTPropsTestView *view; - RCTUIManager *uiManager = _bridge.uiManager; - - XCTestExpectation *initialExpectation = [self expectationWithDescription:@"initial expectation"]; - XCTestExpectation *updateExpectation = [self expectationWithDescription:@"second expectation"]; - - dispatch_async(uiManager.methodQueue, ^{ - [uiManager createView:@2 viewName:@"RCTPropsTestView" rootTag:self->_rootViewReactTag props:@{}]; - [uiManager addUIBlock:^(__unused RCTUIManager *_uiManager, NSDictionary *viewRegistry) { - view = (RCTPropsTestView *)viewRegistry[@2]; - XCTAssertEqual(view.layer.allowsGroupOpacity, TRUE); - [initialExpectation fulfill]; - }]; - [uiManager updateView:@2 viewName:@"RCTPropsTestView" props:@{@"needsOffscreenAlphaCompositing" : @NO}]; - [uiManager addUIBlock:^(__unused RCTUIManager *_uiManager, NSDictionary *viewRegistry) { - view = (RCTPropsTestView *)viewRegistry[@2]; - XCTAssertEqual(view.layer.allowsGroupOpacity, FALSE); - [updateExpectation fulfill]; - }]; - [uiManager setNeedsLayout]; - }); - - [self waitForExpectations:@[ initialExpectation, updateExpectation ] timeout:0.1]; -} - -- (void)testResetProps -{ - __block RCTPropsTestView *view; - RCTUIManager *uiManager = _bridge.uiManager; - NSDictionary *props = - @{@"integerProp" : @58, @"objectProp" : @10, @"structProp" : @{@"x" : @7, @"y" : @8}, @"customProp" : @"Goodbye"}; - - NSDictionary *resetProps = @{ - @"integerProp" : [NSNull null], - @"objectProp" : [NSNull null], - @"structProp" : [NSNull null], - @"customProp" : [NSNull null] - }; - - dispatch_async(uiManager.methodQueue, ^{ - [uiManager createView:@2 viewName:@"RCTPropsTestView" rootTag:self->_rootViewReactTag props:props]; - [uiManager updateView:@2 viewName:@"RCTPropsTestView" props:resetProps]; - [uiManager addUIBlock:^(__unused RCTUIManager *_uiManager, NSDictionary *viewRegistry) { - view = (RCTPropsTestView *)viewRegistry[@2]; - XCTAssertEqual(view.integerProp, 57); - XCTAssertEqualObjects(view.objectProp, @9); - XCTAssertTrue(CGPointEqualToPoint(view.structProp, CGPointMake(5, 6))); - XCTAssertEqualObjects(view.customProp, @"Hello"); - }]; - [uiManager setNeedsLayout]; - }); - - RCT_RUN_RUNLOOP_WHILE(view == nil); -} - -- (void)testResetBackgroundColor -{ - __block RCTView *view; - RCTUIManager *uiManager = _bridge.uiManager; - NSDictionary *props = @{@"backgroundColor" : @0xffffffff}; - NSDictionary *resetProps = @{@"backgroundColor" : [NSNull null]}; - - dispatch_async(uiManager.methodQueue, ^{ - [uiManager createView:@2 viewName:@"RCTView" rootTag:self->_rootViewReactTag props:props]; - [uiManager addUIBlock:^(__unused RCTUIManager *_uiManager, NSDictionary *viewRegistry) { - view = (RCTView *)viewRegistry[@2]; - XCTAssertEqualObjects(view.backgroundColor, [RCTConvert UIColor:@0xffffffff]); - }]; - [uiManager updateView:@2 viewName:@"RCTView" props:resetProps]; - [uiManager - addUIBlock:^(__unused RCTUIManager *_uiManager, __unused NSDictionary *viewRegistry) { - view = (RCTView *)viewRegistry[@2]; - XCTAssertNil(view.backgroundColor); - }]; - [uiManager setNeedsLayout]; - }); - - RCT_RUN_RUNLOOP_WHILE(view == nil); -} - -@end diff --git a/packages/rn-tester/RNTesterUnitTests/RCTDevMenuTests.m b/packages/rn-tester/RNTesterUnitTests/RCTDevMenuTests.m deleted file mode 100644 index 27b6414c01db..000000000000 --- a/packages/rn-tester/RNTesterUnitTests/RCTDevMenuTests.m +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import -#import - -typedef void (^RCTDevMenuAlertActionHandler)(UIAlertAction *action); - -@interface RCTDevMenu () - -- (RCTDevMenuAlertActionHandler)alertActionHandlerForDevItem:(RCTDevMenuItem *)item; - -@end - -@interface RCTDevMenuTests : XCTestCase - -@end - -@implementation RCTDevMenuTests { - RCTBridge *_bridge; -} - -- (void)setUp -{ - [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 - launchOptions:nil]; - - RCT_RUN_RUNLOOP_WHILE(_bridge.isLoading); -} - -- (void)testShowCreatingActionSheet -{ - XCTAssertFalse([_bridge.devMenu isActionSheetShown]); - [_bridge.devMenu show]; - XCTAssertTrue([_bridge.devMenu isActionSheetShown]); -} - -- (void)testClosingActionSheetAfterAction -{ - for (RCTDevMenuItem *item in _bridge.devMenu.presentedItems) { - RCTDevMenuAlertActionHandler handler = [_bridge.devMenu alertActionHandlerForDevItem:item]; - XCTAssertTrue([_bridge.devMenu isActionSheetShown]); - - handler(nil); - XCTAssertFalse([_bridge.devMenu isActionSheetShown]); - - [_bridge.devMenu show]; - XCTAssertTrue([_bridge.devMenu isActionSheetShown]); - } -} - -@end diff --git a/packages/rn-tester/RNTesterUnitTests/RCTGzipTests.m b/packages/rn-tester/RNTesterUnitTests/RCTGzipTests.m index 8fc047cca976..85b753c1dac8 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTGzipTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTGzipTests.m @@ -7,10 +7,22 @@ #import -#import #import #import +#define RCT_RUN_RUNLOOP_WHILE(CONDITION) \ + { \ + NSDate *timeout = [NSDate dateWithTimeIntervalSinceNow:30]; \ + NSRunLoop *runloop = [NSRunLoop mainRunLoop]; \ + while ((CONDITION)) { \ + [runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.01]]; \ + if ([timeout timeIntervalSinceNow] <= 0) { \ + XCTFail(@"Runloop timed out before condition was met"); \ + break; \ + } \ + } \ + } + extern BOOL RCTIsGzippedData(NSData *__nullable data); @interface RCTNetworking (Private) diff --git a/packages/rn-tester/RNTesterUnitTests/RCTImageLoaderHelpers.h b/packages/rn-tester/RNTesterUnitTests/RCTImageLoaderHelpers.h deleted file mode 100644 index 58ebca1a4f94..000000000000 --- a/packages/rn-tester/RNTesterUnitTests/RCTImageLoaderHelpers.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -typedef BOOL (^RCTImageURLLoaderCanLoadImageURLHandler)(NSURL *requestURL); -typedef RCTImageLoaderCancellationBlock (^RCTImageURLLoaderLoadImageURLHandler)( - NSURL *imageURL, - CGSize size, - CGFloat scale, - RCTResizeMode resizeMode, - RCTImageLoaderProgressBlock progressHandler, - RCTImageLoaderCompletionBlock completionHandler); - -@interface RCTConcreteImageURLLoader : NSObject - -- (instancetype)initWithPriority:(float)priority - canLoadImageURLHandler:(RCTImageURLLoaderCanLoadImageURLHandler)canLoadImageURLHandler - loadImageURLHandler:(RCTImageURLLoaderLoadImageURLHandler)loadImageURLHandler; - -@end - -typedef BOOL (^RCTImageDataDecoderCanDecodeImageDataHandler)(NSData *imageData); -typedef RCTImageLoaderCancellationBlock (^RCTImageDataDecoderDecodeImageDataHandler)( - NSData *imageData, - CGSize size, - CGFloat scale, - RCTResizeMode resizeMode, - RCTImageLoaderCompletionBlock completionHandler); - -@interface RCTConcreteImageDecoder : NSObject - -- (instancetype)initWithPriority:(float)priority - canDecodeImageDataHandler:(RCTImageDataDecoderCanDecodeImageDataHandler)canDecodeImageDataHandler - decodeImageDataHandler:(RCTImageDataDecoderDecodeImageDataHandler)decodeImageDataHandler; - -@end - -#define _RCTDefineImageHandler(SUPERCLASS, CLASS_NAME) \ - @interface CLASS_NAME : SUPERCLASS \ - @end \ - @implementation CLASS_NAME \ - RCT_EXPORT_MODULE() @end - -#define RCTDefineImageURLLoader(CLASS_NAME) _RCTDefineImageHandler(RCTConcreteImageURLLoader, CLASS_NAME) - -#define RCTDefineImageDecoder(CLASS_NAME) _RCTDefineImageHandler(RCTConcreteImageDecoder, CLASS_NAME) diff --git a/packages/rn-tester/RNTesterUnitTests/RCTImageLoaderHelpers.m b/packages/rn-tester/RNTesterUnitTests/RCTImageLoaderHelpers.m deleted file mode 100644 index 79649e0405ba..000000000000 --- a/packages/rn-tester/RNTesterUnitTests/RCTImageLoaderHelpers.m +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "RCTImageLoaderHelpers.h" - -@implementation RCTConcreteImageURLLoader { - RCTImageURLLoaderCanLoadImageURLHandler _canLoadImageURLHandler; - RCTImageURLLoaderLoadImageURLHandler _loadImageURLHandler; - float _priority; -} - -+ (NSString *)moduleName -{ - return nil; -} - -- (instancetype)init -{ - return nil; -} - -- (instancetype)initWithPriority:(float)priority - canLoadImageURLHandler:(RCTImageURLLoaderCanLoadImageURLHandler)canLoadImageURLHandler - loadImageURLHandler:(RCTImageURLLoaderLoadImageURLHandler)loadImageURLHandler -{ - if ((self = [super init])) { - _canLoadImageURLHandler = [canLoadImageURLHandler copy]; - _loadImageURLHandler = [loadImageURLHandler copy]; - _priority = priority; - } - - return self; -} - -- (BOOL)canLoadImageURL:(NSURL *)requestURL -{ - return _canLoadImageURLHandler(requestURL); -} - -- (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - progressHandler:(RCTImageLoaderProgressBlock)progressHandler - partialLoadHandler:(__unused RCTImageLoaderPartialLoadBlock)partialLoadHandler - completionHandler:(RCTImageLoaderCompletionBlock)completionHandler -{ - return _loadImageURLHandler(imageURL, size, scale, resizeMode, progressHandler, completionHandler); -} - -- (float)loaderPriority -{ - return _priority; -} - -@end - -@implementation RCTConcreteImageDecoder { - RCTImageDataDecoderCanDecodeImageDataHandler _canDecodeImageDataHandler; - RCTImageDataDecoderDecodeImageDataHandler _decodeImageDataHandler; - float _priority; -} - -+ (NSString *)moduleName -{ - return nil; -} - -- (instancetype)init -{ - return nil; -} - -- (instancetype)initWithPriority:(float)priority - canDecodeImageDataHandler:(RCTImageDataDecoderCanDecodeImageDataHandler)canDecodeImageDataHandler - decodeImageDataHandler:(RCTImageDataDecoderDecodeImageDataHandler)decodeImageDataHandler -{ - if ((self = [super init])) { - _canDecodeImageDataHandler = [canDecodeImageDataHandler copy]; - _decodeImageDataHandler = [decodeImageDataHandler copy]; - _priority = priority; - } - - return self; -} - -- (BOOL)canDecodeImageData:(NSData *)imageData -{ - return _canDecodeImageDataHandler(imageData); -} - -- (RCTImageLoaderCancellationBlock)decodeImageData:(NSData *)imageData - size:(CGSize)size - scale:(CGFloat)scale - resizeMode:(RCTResizeMode)resizeMode - completionHandler:(RCTImageLoaderCompletionBlock)completionHandler -{ - return _decodeImageDataHandler(imageData, size, scale, resizeMode, completionHandler); -} - -- (float)decoderPriority -{ - return _priority; -} - -@end diff --git a/packages/rn-tester/RNTesterUnitTests/RCTImageLoaderTests.m b/packages/rn-tester/RNTesterUnitTests/RCTImageLoaderTests.m index e637140234c5..f2e0d0a58203 100644 --- a/packages/rn-tester/RNTesterUnitTests/RCTImageLoaderTests.m +++ b/packages/rn-tester/RNTesterUnitTests/RCTImageLoaderTests.m @@ -7,11 +7,8 @@ #import -#import #import -#import "RCTImageLoaderHelpers.h" - unsigned char blackGIF[] = {0x47, 0x49, 0x46, 0x38, 0x39, 0x61, 0x01, 0x00, 0x01, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x02, 0x02, 0x44, 0x01, 0x00, 0x3b}; @@ -105,218 +102,3 @@ - (void)testCachedImagePreservesNaturalSizeWhenNotClipped } @end - -@interface RCTImageLoaderTests : XCTestCase - -@end - -@implementation RCTImageLoaderTests { - NSURL *_bundleURL; -} - -- (void)setUp -{ - XCTSkip(@"Skipping RCTImageLoaderTests since they rely on deprecated RCTBridge functionality."); - - NSBundle *bundle = [NSBundle bundleForClass:[self class]]; - _bundleURL = [bundle URLForResource:@"RNTesterUnitTestsBundle" withExtension:@"js"]; -} - -- (void)testImageLoading -{ - UIImage *image = [UIImage new]; - - id loader = [[RCTImageLoaderTestsURLLoader1 alloc] initWithPriority:1.0 - canLoadImageURLHandler:^BOOL(__unused NSURL *requestURL) { - return YES; - } - loadImageURLHandler:^RCTImageLoaderCancellationBlock( - __unused NSURL *imageURL, - __unused CGSize size, - __unused CGFloat scale, - __unused RCTResizeMode resizeMode, - RCTImageLoaderProgressBlock progressHandler, - RCTImageLoaderCompletionBlock completionHandler) { - progressHandler(1, 1); - completionHandler(nil, image); - return nil; - }]; - - NS_VALID_UNTIL_END_OF_SCOPE RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL - moduleProvider:^{ - return @[ loader ]; - } - launchOptions:nil]; - - NSURLRequest *urlRequest = - [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://reactnative.dev/img/opengraph.png"]]; - [[bridge moduleForClass:[RCTImageLoader class]] loadImageWithURLRequest:urlRequest - size:CGSizeMake(100, 100) - scale:1.0 - clipped:YES - resizeMode:RCTResizeModeContain - progressBlock:^(int64_t progress, int64_t total) { - XCTAssertEqual(progress, 1); - XCTAssertEqual(total, 1); - } - partialLoadBlock:^(UIImage *loadedImage) { - } - completionBlock:^(NSError *loadError, id loadedImage) { - XCTAssertEqualObjects(loadedImage, image); - XCTAssertNil(loadError); - }]; -} - -- (void)testImageLoaderUsesImageURLLoaderWithHighestPriority -{ - UIImage *image = [UIImage new]; - - id loader1 = [[RCTImageLoaderTestsURLLoader1 alloc] initWithPriority:1.0 - canLoadImageURLHandler:^BOOL(__unused NSURL *requestURL) { - return YES; - } - loadImageURLHandler:^RCTImageLoaderCancellationBlock( - __unused NSURL *imageURL, - __unused CGSize size, - __unused CGFloat scale, - __unused RCTResizeMode resizeMode, - RCTImageLoaderProgressBlock progressHandler, - RCTImageLoaderCompletionBlock completionHandler) { - progressHandler(1, 1); - completionHandler(nil, image); - return nil; - }]; - - id loader2 = [[RCTImageLoaderTestsURLLoader2 alloc] initWithPriority:0.5 - canLoadImageURLHandler:^BOOL(__unused NSURL *requestURL) { - return YES; - } - loadImageURLHandler:^RCTImageLoaderCancellationBlock( - __unused NSURL *imageURL, - __unused CGSize size, - __unused CGFloat scale, - __unused RCTResizeMode resizeMode, - __unused RCTImageLoaderProgressBlock progressHandler, - __unused RCTImageLoaderCompletionBlock completionHandler) { - XCTFail(@"Should not have used loader2"); - return nil; - }]; - - NS_VALID_UNTIL_END_OF_SCOPE RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL - moduleProvider:^{ - return @[ loader1, loader2 ]; - } - launchOptions:nil]; - - NSURLRequest *urlRequest = - [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://reactnative.dev/img/opengraph.png"]]; - [[bridge moduleForClass:[RCTImageLoader class]] loadImageWithURLRequest:urlRequest - size:CGSizeMake(100, 100) - scale:1.0 - clipped:YES - resizeMode:RCTResizeModeContain - progressBlock:^(int64_t progress, int64_t total) { - XCTAssertEqual(progress, 1); - XCTAssertEqual(total, 1); - } - partialLoadBlock:^(UIImage *loadedImage) { - } - completionBlock:^(NSError *loadError, id loadedImage) { - XCTAssertEqualObjects(loadedImage, image); - XCTAssertNil(loadError); - }]; -} - -- (void)testImageDecoding -{ - NSData *data = [NSData dataWithBytesNoCopy:blackGIF length:sizeof(blackGIF) freeWhenDone:NO]; - UIImage *image = [[UIImage alloc] initWithData:data]; - - id decoder = [[RCTImageLoaderTestsDecoder1 alloc] initWithPriority:1.0 - canDecodeImageDataHandler:^BOOL(__unused NSData *imageData) { - return YES; - } - decodeImageDataHandler:^RCTImageLoaderCancellationBlock( - NSData *imageData, - __unused CGSize size, - __unused CGFloat scale, - __unused RCTResizeMode resizeMode, - RCTImageLoaderCompletionBlock completionHandler) { - XCTAssertEqualObjects(imageData, data); - completionHandler(nil, image); - return nil; - }]; - - NS_VALID_UNTIL_END_OF_SCOPE RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL - moduleProvider:^{ - return @[ decoder ]; - } - launchOptions:nil]; - - RCTImageLoaderCancellationBlock cancelBlock = - [[bridge moduleForClass:[RCTImageLoader class]] decodeImageData:data - size:CGSizeMake(1, 1) - scale:1.0 - clipped:NO - resizeMode:RCTResizeModeStretch - completionBlock:^(NSError *decodeError, id decodedImage) { - XCTAssertEqualObjects(decodedImage, image); - XCTAssertNil(decodeError); - }]; - XCTAssertNotNil(cancelBlock); -} - -- (void)testImageLoaderUsesImageDecoderWithHighestPriority -{ - NSData *data = [NSData dataWithBytesNoCopy:blackGIF length:sizeof(blackGIF) freeWhenDone:NO]; - UIImage *image = [[UIImage alloc] initWithData:data]; - - id decoder1 = [[RCTImageLoaderTestsDecoder1 alloc] initWithPriority:1.0 - canDecodeImageDataHandler:^BOOL(__unused NSData *imageData) { - return YES; - } - decodeImageDataHandler:^RCTImageLoaderCancellationBlock( - NSData *imageData, - __unused CGSize size, - __unused CGFloat scale, - __unused RCTResizeMode resizeMode, - RCTImageLoaderCompletionBlock completionHandler) { - XCTAssertEqualObjects(imageData, data); - completionHandler(nil, image); - return nil; - }]; - - id decoder2 = [[RCTImageLoaderTestsDecoder2 alloc] initWithPriority:0.5 - canDecodeImageDataHandler:^BOOL(__unused NSData *imageData) { - return YES; - } - decodeImageDataHandler:^RCTImageLoaderCancellationBlock( - __unused NSData *imageData, - __unused CGSize size, - __unused CGFloat scale, - __unused RCTResizeMode resizeMode, - __unused RCTImageLoaderCompletionBlock completionHandler) { - XCTFail(@"Should not have used decoder2"); - return nil; - }]; - - NS_VALID_UNTIL_END_OF_SCOPE RCTBridge *bridge = [[RCTBridge alloc] initWithBundleURL:_bundleURL - moduleProvider:^{ - return @[ decoder1, decoder2 ]; - } - launchOptions:nil]; - - RCTImageLoaderCancellationBlock cancelBlock = - [[bridge moduleForClass:[RCTImageLoader class]] decodeImageData:data - size:CGSizeMake(1, 1) - scale:1.0 - clipped:NO - resizeMode:RCTResizeModeStretch - completionBlock:^(NSError *decodeError, id decodedImage) { - XCTAssertEqualObjects(decodedImage, image); - XCTAssertNil(decodeError); - }]; - XCTAssertNotNil(cancelBlock); -} - -@end diff --git a/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js b/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js index c6631de7a752..56a3d3b0cc9a 100644 --- a/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js +++ b/packages/rn-tester/js/examples/Snapshot/SnapshotViewIOS.ios.js @@ -13,16 +13,11 @@ import type {NativeSyntheticEvent, ViewProps} from 'react-native'; const React = require('react'); -const {NativeModules, StyleSheet, UIManager, View} = require('react-native'); +const {NativeModules, StyleSheet, View} = require('react-native'); const {TestModule} = NativeModules; -// Verify that RCTSnapshot is part of the UIManager since it is only loaded -// if you have linked against RCTTest like in tests, otherwise we will have -// a warning printed out -const RCTSnapshot = UIManager.hasViewManagerConfig('RCTSnapshot') - ? require('../../../RCTTest/RCTSnapshotNativeComponent') - : View; +const RCTSnapshot = View; type SnapshotReadyEvent = NativeSyntheticEvent< Readonly<{testIdentifier: string, ...}>, diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index 8de2c49759a6..f3d8836cb2af 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -5,11 +5,6 @@ category NSTextStorage(FontScaling) { public virtual void scaleFontSizeWithRatio:minimumFontSize:maximumFontSize:(CGFloat ratio, CGFloat minimumFontSize, CGFloat maximumFontSize); } -category RCTBridge(Inspector) { - public @property (assign, readonly) BOOL inspectable; - public @property (assign, readonly) facebook::react::jsinspector_modern::HostTarget* inspectorTarget; -} - category RCTBridge(RCTAccessibilityManager) { public @property (assign, readonly) RCTAccessibilityManager* accessibilityManager; } @@ -38,11 +33,6 @@ category RCTBridge(RCTNetworking) { public @property (assign, readonly) RCTNetworking* networking; } -category RCTBridge(RCTSurfacePresenterStub) { - public virtual id surfacePresenter(); - public virtual void setSurfacePresenter:(id presenter); -} - category RCTBridge(RCTUIManager) { public @property (assign, readonly) RCTUIManager* uiManager; } @@ -672,28 +662,16 @@ interface RCTBlobManager : public NSObject { public @property (assign, readonly) BOOL loading; public @property (assign, readonly) BOOL valid; - public @property (copy, readonly) NSArray* moduleClasses; public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong) Class executorClass; public @property (strong, readonly) NSURL* bundleURL; public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; - public @property (weak, readonly) id delegate; - public virtual BOOL isBatchActive(); - public virtual BOOL moduleIsInitialized:(Class moduleClass); - public virtual NSArray* modulesConformingToProtocol:(Protocol* protocol); public virtual RCTBridgeModuleDecorator* bridgeModuleDecorator(); public virtual id moduleForClass:(Class moduleClass); public virtual id moduleForName:(NSString* moduleName); public virtual id moduleForName:lazilyLoadIfNecessary:(NSString* moduleName, BOOL lazilyLoad); - public virtual instancetype initWithBundleURL:moduleProvider:launchOptions:(NSURL* bundleURL, RCTBridgeModuleListProvider block, NSDictionary* launchOptions); - public virtual instancetype initWithDelegate:launchOptions:(id delegate, NSDictionary* launchOptions); - public virtual void enqueueJSCall:args:(NSString* moduleDotMethod, NSArray* args); - public virtual void enqueueJSCall:method:args:completion:(NSString* module, NSString* method, NSArray* args, dispatch_block_t completion); public virtual void onFastRefresh(); public virtual void registerSegmentWithId:path:(NSUInteger segmentId, NSString* path); - public virtual void reload(); - public virtual void reloadWithReason:(NSString* reason); - public virtual void requestReload(); public virtual void setRCTTurboModuleRegistry:(id turboModuleRegistry); } @@ -1349,22 +1327,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView { - public @property (assign) BOOL requiresMainQueueSetup; - public @property (assign, readonly) BOOL hasConstantsToExport; - public @property (assign, readonly) BOOL hasInstance; - public @property (assign, readonly) BOOL implementsBatchDidComplete; - public @property (copy, readonly) NSArray>* methods; - public @property (copy, readonly) NSDictionary>* methodsByName; - public @property (copy, readonly) NSDictionary* exportedConstants; - public @property (copy, readonly) NSString* name; - public @property (strong) id instance; - public @property (strong, readonly) Class moduleClass; - public @property (strong, readonly) dispatch_queue_t methodQueue; - public @property (weak) id callInvokerProvider; - public virtual void gatherConstants(); -} - interface RCTModuleMethod : public NSObject { public @property (assign, readonly) Class moduleClass; public @property (assign, readonly) SEL selector; @@ -2541,7 +2503,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput { } protocol RCTBridgeDelegate : public NSObject { - public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge); } protocol RCTBridgeMethod : public NSObject { @@ -2793,10 +2754,6 @@ protocol RCTLocalizationProtocol : public NSObject { protocol RCTModalHostViewViewProtocol : public NSObject { } -protocol RCTModuleDataCallInvokerProvider : public NSObject { - public virtual RCTCallInvoker* callInvokerForModuleData:(RCTModuleData* moduleData); -} - protocol RCTModuleProvider : public NSObjectNSObject { public virtual std::shared_ptr getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params); } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api index 6b5e45141f07..4842572b5d0c 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleFrameworksCxx.api @@ -5,11 +5,6 @@ category NSTextStorage(FontScaling) { public virtual void scaleFontSizeWithRatio:minimumFontSize:maximumFontSize:(CGFloat ratio, CGFloat minimumFontSize, CGFloat maximumFontSize); } -category RCTBridge(Inspector) { - public @property (assign, readonly) BOOL inspectable; - public @property (assign, readonly) facebook::react::jsinspector_modern::HostTarget* inspectorTarget; -} - category RCTBridge(RCTAccessibilityManager) { public @property (assign, readonly) RCTAccessibilityManager* accessibilityManager; } @@ -38,11 +33,6 @@ category RCTBridge(RCTNetworking) { public @property (assign, readonly) RCTNetworking* networking; } -category RCTBridge(RCTSurfacePresenterStub) { - public virtual id surfacePresenter(); - public virtual void setSurfacePresenter:(id presenter); -} - category RCTBridge(RCTUIManager) { public @property (assign, readonly) RCTUIManager* uiManager; } @@ -681,28 +671,16 @@ interface RCTBlobManager : public NSObject { public @property (assign, readonly) BOOL loading; public @property (assign, readonly) BOOL valid; - public @property (copy, readonly) NSArray* moduleClasses; public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong) Class executorClass; public @property (strong, readonly) NSURL* bundleURL; public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; - public @property (weak, readonly) id delegate; - public virtual BOOL isBatchActive(); - public virtual BOOL moduleIsInitialized:(Class moduleClass); - public virtual NSArray* modulesConformingToProtocol:(Protocol* protocol); public virtual RCTBridgeModuleDecorator* bridgeModuleDecorator(); public virtual id moduleForClass:(Class moduleClass); public virtual id moduleForName:(NSString* moduleName); public virtual id moduleForName:lazilyLoadIfNecessary:(NSString* moduleName, BOOL lazilyLoad); - public virtual instancetype initWithBundleURL:moduleProvider:launchOptions:(NSURL* bundleURL, RCTBridgeModuleListProvider block, NSDictionary* launchOptions); - public virtual instancetype initWithDelegate:launchOptions:(id delegate, NSDictionary* launchOptions); - public virtual void enqueueJSCall:args:(NSString* moduleDotMethod, NSArray* args); - public virtual void enqueueJSCall:method:args:completion:(NSString* module, NSString* method, NSArray* args, dispatch_block_t completion); public virtual void onFastRefresh(); public virtual void registerSegmentWithId:path:(NSUInteger segmentId, NSString* path); - public virtual void reload(); - public virtual void reloadWithReason:(NSString* reason); - public virtual void requestReload(); public virtual void setRCTTurboModuleRegistry:(id turboModuleRegistry); } @@ -1392,22 +1370,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView { - public @property (assign) BOOL requiresMainQueueSetup; - public @property (assign, readonly) BOOL hasConstantsToExport; - public @property (assign, readonly) BOOL hasInstance; - public @property (assign, readonly) BOOL implementsBatchDidComplete; - public @property (copy, readonly) NSArray>* methods; - public @property (copy, readonly) NSDictionary>* methodsByName; - public @property (copy, readonly) NSDictionary* exportedConstants; - public @property (copy, readonly) NSString* name; - public @property (strong) id instance; - public @property (strong, readonly) Class moduleClass; - public @property (strong, readonly) dispatch_queue_t methodQueue; - public @property (weak) id callInvokerProvider; - public virtual void gatherConstants(); -} - interface RCTModuleMethod : public NSObject { public @property (assign, readonly) Class moduleClass; public @property (assign, readonly) SEL selector; @@ -2599,7 +2561,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput { } protocol RCTBridgeDelegate : public NSObject { - public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge); } protocol RCTBridgeMethod : public NSObject { @@ -2874,10 +2835,6 @@ protocol RCTLocalizationProtocol : public NSObject { protocol RCTModalHostViewViewProtocol : public NSObject { } -protocol RCTModuleDataCallInvokerProvider : public NSObject { - public virtual RCTCallInvoker* callInvokerForModuleData:(RCTModuleData* moduleData); -} - protocol RCTModuleProvider : public NSObjectNSObject { public virtual std::shared_ptr getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params); } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index e8201541b2e1..c723c751f72e 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -5,11 +5,6 @@ category NSTextStorage(FontScaling) { public virtual void scaleFontSizeWithRatio:minimumFontSize:maximumFontSize:(CGFloat ratio, CGFloat minimumFontSize, CGFloat maximumFontSize); } -category RCTBridge(Inspector) { - public @property (assign, readonly) BOOL inspectable; - public @property (assign, readonly) facebook::react::jsinspector_modern::HostTarget* inspectorTarget; -} - category RCTBridge(RCTAccessibilityManager) { public @property (assign, readonly) RCTAccessibilityManager* accessibilityManager; } @@ -38,11 +33,6 @@ category RCTBridge(RCTNetworking) { public @property (assign, readonly) RCTNetworking* networking; } -category RCTBridge(RCTSurfacePresenterStub) { - public virtual id surfacePresenter(); - public virtual void setSurfacePresenter:(id presenter); -} - category RCTBridge(RCTUIManager) { public @property (assign, readonly) RCTUIManager* uiManager; } @@ -672,28 +662,16 @@ interface RCTBlobManager : public NSObject { public @property (assign, readonly) BOOL loading; public @property (assign, readonly) BOOL valid; - public @property (copy, readonly) NSArray* moduleClasses; public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong) Class executorClass; public @property (strong, readonly) NSURL* bundleURL; public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; - public @property (weak, readonly) id delegate; - public virtual BOOL isBatchActive(); - public virtual BOOL moduleIsInitialized:(Class moduleClass); - public virtual NSArray* modulesConformingToProtocol:(Protocol* protocol); public virtual RCTBridgeModuleDecorator* bridgeModuleDecorator(); public virtual id moduleForClass:(Class moduleClass); public virtual id moduleForName:(NSString* moduleName); public virtual id moduleForName:lazilyLoadIfNecessary:(NSString* moduleName, BOOL lazilyLoad); - public virtual instancetype initWithBundleURL:moduleProvider:launchOptions:(NSURL* bundleURL, RCTBridgeModuleListProvider block, NSDictionary* launchOptions); - public virtual instancetype initWithDelegate:launchOptions:(id delegate, NSDictionary* launchOptions); - public virtual void enqueueJSCall:args:(NSString* moduleDotMethod, NSArray* args); - public virtual void enqueueJSCall:method:args:completion:(NSString* module, NSString* method, NSArray* args, dispatch_block_t completion); public virtual void onFastRefresh(); public virtual void registerSegmentWithId:path:(NSUInteger segmentId, NSString* path); - public virtual void reload(); - public virtual void reloadWithReason:(NSString* reason); - public virtual void requestReload(); public virtual void setRCTTurboModuleRegistry:(id turboModuleRegistry); } @@ -1349,22 +1327,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView { - public @property (assign) BOOL requiresMainQueueSetup; - public @property (assign, readonly) BOOL hasConstantsToExport; - public @property (assign, readonly) BOOL hasInstance; - public @property (assign, readonly) BOOL implementsBatchDidComplete; - public @property (copy, readonly) NSArray>* methods; - public @property (copy, readonly) NSDictionary>* methodsByName; - public @property (copy, readonly) NSDictionary* exportedConstants; - public @property (copy, readonly) NSString* name; - public @property (strong) id instance; - public @property (strong, readonly) Class moduleClass; - public @property (strong, readonly) dispatch_queue_t methodQueue; - public @property (weak) id callInvokerProvider; - public virtual void gatherConstants(); -} - interface RCTModuleMethod : public NSObject { public @property (assign, readonly) Class moduleClass; public @property (assign, readonly) SEL selector; @@ -2785,10 +2747,6 @@ protocol RCTLocalizationProtocol : public NSObject { protocol RCTModalHostViewViewProtocol : public NSObject { } -protocol RCTModuleDataCallInvokerProvider : public NSObject { - public virtual RCTCallInvoker* callInvokerForModuleData:(RCTModuleData* moduleData); -} - protocol RCTModuleProvider : public NSObjectNSObject { public virtual std::shared_ptr getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params); } diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index d3ff97cc59c6..7504f4753c4a 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -5,11 +5,6 @@ category NSTextStorage(FontScaling) { public virtual void scaleFontSizeWithRatio:minimumFontSize:maximumFontSize:(CGFloat ratio, CGFloat minimumFontSize, CGFloat maximumFontSize); } -category RCTBridge(Inspector) { - public @property (assign, readonly) BOOL inspectable; - public @property (assign, readonly) facebook::react::jsinspector_modern::HostTarget* inspectorTarget; -} - category RCTBridge(RCTAccessibilityManager) { public @property (assign, readonly) RCTAccessibilityManager* accessibilityManager; } @@ -38,11 +33,6 @@ category RCTBridge(RCTNetworking) { public @property (assign, readonly) RCTNetworking* networking; } -category RCTBridge(RCTSurfacePresenterStub) { - public virtual id surfacePresenter(); - public virtual void setSurfacePresenter:(id presenter); -} - category RCTBridge(RCTUIManager) { public @property (assign, readonly) RCTUIManager* uiManager; } @@ -672,28 +662,16 @@ interface RCTBlobManager : public NSObject { public @property (assign, readonly) BOOL loading; public @property (assign, readonly) BOOL valid; - public @property (copy, readonly) NSArray* moduleClasses; public @property (copy, readonly) NSDictionary* launchOptions; public @property (strong) Class executorClass; public @property (strong, readonly) NSURL* bundleURL; public @property (strong, readonly) RCTPerformanceLogger* performanceLogger; - public @property (weak, readonly) id delegate; - public virtual BOOL isBatchActive(); - public virtual BOOL moduleIsInitialized:(Class moduleClass); - public virtual NSArray* modulesConformingToProtocol:(Protocol* protocol); public virtual RCTBridgeModuleDecorator* bridgeModuleDecorator(); public virtual id moduleForClass:(Class moduleClass); public virtual id moduleForName:(NSString* moduleName); public virtual id moduleForName:lazilyLoadIfNecessary:(NSString* moduleName, BOOL lazilyLoad); - public virtual instancetype initWithBundleURL:moduleProvider:launchOptions:(NSURL* bundleURL, RCTBridgeModuleListProvider block, NSDictionary* launchOptions); - public virtual instancetype initWithDelegate:launchOptions:(id delegate, NSDictionary* launchOptions); - public virtual void enqueueJSCall:args:(NSString* moduleDotMethod, NSArray* args); - public virtual void enqueueJSCall:method:args:completion:(NSString* module, NSString* method, NSArray* args, dispatch_block_t completion); public virtual void onFastRefresh(); public virtual void registerSegmentWithId:path:(NSUInteger segmentId, NSString* path); - public virtual void reload(); - public virtual void reloadWithReason:(NSString* reason); - public virtual void requestReload(); public virtual void setRCTTurboModuleRegistry:(id turboModuleRegistry); } @@ -1349,22 +1327,6 @@ interface RCTModalHostViewComponentView : public RCTViewComponentView { - public @property (assign) BOOL requiresMainQueueSetup; - public @property (assign, readonly) BOOL hasConstantsToExport; - public @property (assign, readonly) BOOL hasInstance; - public @property (assign, readonly) BOOL implementsBatchDidComplete; - public @property (copy, readonly) NSArray>* methods; - public @property (copy, readonly) NSDictionary>* methodsByName; - public @property (copy, readonly) NSDictionary* exportedConstants; - public @property (copy, readonly) NSString* name; - public @property (strong) id instance; - public @property (strong, readonly) Class moduleClass; - public @property (strong, readonly) dispatch_queue_t methodQueue; - public @property (weak) id callInvokerProvider; - public virtual void gatherConstants(); -} - interface RCTModuleMethod : public NSObject { public @property (assign, readonly) Class moduleClass; public @property (assign, readonly) SEL selector; @@ -2541,7 +2503,6 @@ protocol RCTBackedTextInputViewProtocol : public UITextInput { } protocol RCTBridgeDelegate : public NSObject { - public virtual NSURL* _Nullable sourceURLForBridge:(RCTBridge* bridge); } protocol RCTBridgeMethod : public NSObject { @@ -2793,10 +2754,6 @@ protocol RCTLocalizationProtocol : public NSObject { protocol RCTModalHostViewViewProtocol : public NSObject { } -protocol RCTModuleDataCallInvokerProvider : public NSObject { - public virtual RCTCallInvoker* callInvokerForModuleData:(RCTModuleData* moduleData); -} - protocol RCTModuleProvider : public NSObjectNSObject { public virtual std::shared_ptr getTurboModule:(const facebook::react::ObjCTurboModule::InitParams& params); } diff --git a/scripts/objc-test.sh b/scripts/objc-test.sh index 73f82a35b0b3..22680c3bf0bb 100755 --- a/scripts/objc-test.sh +++ b/scripts/objc-test.sh @@ -116,11 +116,6 @@ xcbeautifyFormat() { xcbeautify --report junit --report-path "$REPORTS_DIR/ios/results.xml" } -preloadBundlesRNIntegrationTests() { - # Preload IntegrationTests bundles (packages/rn-tester/) - curl -s 'http://localhost:8081/IntegrationTests/IntegrationTestsApp.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 @@ -143,7 +138,6 @@ main() { yarn start --max-workers=1 || echo "Can't start packager automatically" & waitForPackager preloadBundlesRNTester - preloadBundlesRNIntegrationTests buildForTesting