mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Follow up e2e testing mechanism with real tests (#25680)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/25680 This diff's adding real e2e tests for skeleton added in previous diff. It verifies many cases for codegen, which should generate cpp code. Reviewed By: rickhanlonii Differential Revision: D16279810 fbshipit-source-id: 4441dd0ed4d95476e4071fbd654ebfb8a47ecbfc
This commit is contained in:
1 parent
d6722477c4
commit
6e73304401
23 files changed
+219
-46
No files matched your search
@@ -37,8 +37,8 @@ fb_native.genrule(
|
||||
name = "codegen_tests_schema",
|
||||
srcs = glob(
|
||||
[
|
||||
"**/e2e/__test_fixtures__/*NativeComponent.js",
|
||||
"**/e2e/__test_fixtures__/Native*.js",
|
||||
"**/e2e/__test_fixtures__/components/*NativeComponent.js",
|
||||
"**/e2e/__test_fixtures__/modules/Native*.js",
|
||||
],
|
||||
),
|
||||
cmd = "$(exe fbsource//xplat/js/react-native-github/packages/react-native-codegen:write_to_json) $OUT $SRCS",
|
||||
|
||||
+5
-5
@@ -13,15 +13,15 @@
|
||||
import type {
|
||||
PointValue,
|
||||
ColorValue,
|
||||
} from '../../../../Libraries/StyleSheet/StyleSheetTypes';
|
||||
import type {ImageSource} from '../../../../Libraries/Image/ImageSource';
|
||||
} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
|
||||
import type {ImageSource} from '../../../../../Libraries/Image/ImageSource';
|
||||
import type {
|
||||
Int32,
|
||||
Float,
|
||||
WithDefault,
|
||||
} from '../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
} from '../../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+3
-3
@@ -10,9 +10,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {WithDefault} from '../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
import type {WithDefault} from '../../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+3
-3
@@ -10,9 +10,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {ColorValue} from '../../../../Libraries/StyleSheet/StyleSheetTypes';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
import type {ColorValue} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+3
-3
@@ -10,9 +10,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {WithDefault} from '../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
import type {WithDefault} from '../../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+3
-3
@@ -14,9 +14,9 @@ import type {
|
||||
Int32,
|
||||
BubblingEventHandler,
|
||||
WithDefault,
|
||||
} from '../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
} from '../../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type OnChangeEvent = $ReadOnly<{|
|
||||
location: {
|
||||
+3
-3
@@ -16,9 +16,9 @@ import type {
|
||||
BubblingEventHandler,
|
||||
DirectEventHandler,
|
||||
WithDefault,
|
||||
} from '../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
} from '../../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type OnChangeEvent = $ReadOnly<{|
|
||||
value: boolean,
|
||||
+3
-3
@@ -13,9 +13,9 @@
|
||||
import type {
|
||||
WithDefault,
|
||||
Float,
|
||||
} from '../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
} from '../../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+3
-3
@@ -10,9 +10,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {ImageSource} from '../../../../Libraries/Image/ImageSource';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
import type {ImageSource} from '../../../../../Libraries/Image/ImageSource';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+3
-3
@@ -13,9 +13,9 @@
|
||||
import type {
|
||||
WithDefault,
|
||||
Int32,
|
||||
} from '../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
} from '../../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+3
-3
@@ -13,9 +13,9 @@
|
||||
import type {
|
||||
BubblingEventHandler,
|
||||
WithDefault,
|
||||
} from '../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
} from '../../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+4
-4
@@ -13,10 +13,10 @@
|
||||
import type {
|
||||
PointValue,
|
||||
ColorValue,
|
||||
} from '../../../../Libraries/StyleSheet/StyleSheetTypes';
|
||||
import type {ImageSource} from '../../../../Libraries/Image/ImageSource';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
|
||||
import type {ImageSource} from '../../../../../Libraries/Image/ImageSource';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+2
-2
@@ -10,8 +10,8 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+3
-3
@@ -10,9 +10,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PointValue} from '../../../../Libraries/StyleSheet/StyleSheetTypes';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
import type {PointValue} from '../../../../../Libraries/StyleSheet/StyleSheetTypes';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+3
-3
@@ -10,9 +10,9 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {WithDefault} from '../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
import type {WithDefault} from '../../../../../Libraries/Types/CodegenTypes';
|
||||
import type {ViewProps} from '../../../../../Libraries/Components/View/ViewPropTypes';
|
||||
import codegenNativeComponent from '../../../../../Libraries/Utilities/codegenNativeComponent';
|
||||
|
||||
type NativeProps = $ReadOnly<{|
|
||||
...ViewProps,
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its 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 type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
||||
|
||||
export type ArrayType = string;
|
||||
type AnotherArray = Array<ArrayType>;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+getArray: (a: Array<any>) => Array<string>;
|
||||
+getArrayWithAlias: (a: AnotherArray, b: Array<ArrayType>) => AnotherArray;
|
||||
}
|
||||
|
||||
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its 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 type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
||||
|
||||
export type Boolean = boolean;
|
||||
type AnotherBoolean = Boolean;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+getBoolean: (arg: boolean) => boolean;
|
||||
+getBooleanWithAlias: (arg: Boolean) => AnotherBoolean;
|
||||
}
|
||||
|
||||
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its 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 type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
||||
|
||||
export type String = string;
|
||||
type CB = (value: String) => void;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+getValueWithCallback: (callback: (value: string) => void) => void;
|
||||
+getValueWithCallbackWithAlias: (c: CB) => void;
|
||||
}
|
||||
|
||||
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its 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 type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
||||
|
||||
export type Number = number;
|
||||
type AnotherNumber = Number;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+getNumber: (arg: number) => number;
|
||||
+getNumberWithAlias: (arg: Number) => AnotherNumber;
|
||||
}
|
||||
|
||||
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its 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 type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
||||
|
||||
export type GenericObject = Object;
|
||||
type AnotherGenericObject = GenericObject;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+getGenericObject: (arg: Object) => Object;
|
||||
+getGenericObjectWithAlias: (arg: GenericObject) => AnotherGenericObject;
|
||||
+getConstants: () => {|
|
||||
const1: boolean,
|
||||
const2: number,
|
||||
const3: string,
|
||||
|};
|
||||
}
|
||||
|
||||
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its 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 type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
||||
|
||||
export type String = string;
|
||||
type AnotherPromise = Promise<String>;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+getValueWithPromise: (error: boolean) => Promise<string>;
|
||||
+getValueWithPromiseWithAlias: (arg: String) => AnotherPromise;
|
||||
}
|
||||
|
||||
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
||||
File renamed without changes.
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its 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 type {TurboModule} from 'react-native/Libraries/TurboModule/RCTExport';
|
||||
import * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
||||
|
||||
export type String = string;
|
||||
type AnotherString = String;
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
+getString: (arg: string) => string;
|
||||
+getStringWithAlias: (arg: String) => AnotherString;
|
||||
}
|
||||
|
||||
export default TurboModuleRegistry.getEnforcing<Spec>('SampleTurboModule');
|
||||
Reference in new issue
Block a user