fix ut for validation

Signed-off-by: s00912778 <shijiakai2@huawei.com>
Change-Id: Iea4b13580ca0cfed6871c9e7a4beae6293a1e8d7
This commit is contained in:
s00912778 2024-10-22 15:25:17 +08:00
parent dff927600e
commit da30068cdd
3 changed files with 157 additions and 156 deletions

View File

@ -1,159 +1,159 @@
export const UT_PAGES: string[] = [
'import/import@CustomDialog',
'import/import@Observed',
'import/importAllEts',
'import/importEts',
'import/importExportEts',
'import/importExportNest',
'import/importSystemApi',
'import/importTs',
// 'import/import@CustomDialog',
// 'import/import@Observed',
// 'import/importAllEts',
// 'import/importEts',
// 'import/importExportEts',
// 'import/importExportNest',
// 'import/importSystemApi',
// 'import/importTs',
'inner_commponent_transform/$$_component/$$_component',
'inner_commponent_transform/custom_component/custom_component',
'inner_commponent_transform/gesture_component/longPressGesture',
'inner_commponent_transform/gesture_component/panGestrue',
'inner_commponent_transform/gesture_component/pinchGesture',
'inner_commponent_transform/gesture_component/rotationGesture',
'inner_commponent_transform/gesture_component/swipeGesture',
'inner_commponent_transform/gesture_component/tapGesture',
'inner_commponent_transform/render_component/forEach/forEach',
'inner_commponent_transform/render_component/forEach/forEachSecondFunction',
'inner_commponent_transform/render_component/forEach/forEachTwo',
'inner_commponent_transform/render_component/if/if',
'inner_commponent_transform/render_component/lazyForEach/lazyForEach',
'inner_commponent_transform/simple_component/button/button',
'inner_commponent_transform/transition_component/animateTo/animateTo',
'inner_commponent_transform/transition_component/pageTransition/pageTransition',
// 'inner_commponent_transform/$$_component/$$_component',
// 'inner_commponent_transform/custom_component/custom_component',
// 'inner_commponent_transform/gesture_component/longPressGesture',
// 'inner_commponent_transform/gesture_component/panGestrue',
// 'inner_commponent_transform/gesture_component/pinchGesture',
// 'inner_commponent_transform/gesture_component/rotationGesture',
// 'inner_commponent_transform/gesture_component/swipeGesture',
// 'inner_commponent_transform/gesture_component/tapGesture',
// 'inner_commponent_transform/render_component/forEach/forEach',
// 'inner_commponent_transform/render_component/forEach/forEachSecondFunction',
// 'inner_commponent_transform/render_component/forEach/forEachTwo',
// 'inner_commponent_transform/render_component/if/if',
// 'inner_commponent_transform/render_component/lazyForEach/lazyForEach',
// 'inner_commponent_transform/simple_component/button/button',
// 'inner_commponent_transform/transition_component/animateTo/animateTo',
// 'inner_commponent_transform/transition_component/pageTransition/pageTransition',
'render_decorator/@builder/@builder',
'render_decorator/@builder/@builderWithForEach',
'render_decorator/@builder/@builderWithLinkData',
'render_decorator/@builderParam/@builderParam',
'render_decorator/@customDialog/@customDialog',
'render_decorator/@extend/@extend',
'render_decorator/@preview/@preview',
'render_decorator/@styles/@styles',
'render_decorator/@styles/@stylesExport',
// 'render_decorator/@builder/@builder',
// 'render_decorator/@builder/@builderWithForEach',
// 'render_decorator/@builder/@builderWithLinkData',
// 'render_decorator/@builderParam/@builderParam',
// 'render_decorator/@customDialog/@customDialog',
// 'render_decorator/@extend/@extend',
// 'render_decorator/@preview/@preview',
// 'render_decorator/@styles/@styles',
// 'render_decorator/@styles/@stylesExport',
'ui_state_management/application_state_management/@storageLink/@storageLink',
'ui_state_management/application_state_management/@storageProp/@storageProp',
'ui_state_management/application_state_management/appStorage/appStorage',
'ui_state_management/application_state_management/localStorage/localStorage',
'ui_state_management/inner_struct_state_management/@link/@link',
'ui_state_management/inner_struct_state_management/@prop/@prop',
'ui_state_management/others/@consume_@provide/@consume_@provide',
'ui_state_management/others/@observed_@objectLink/@observed_@objectLink',
'ui_state_management/others/@watch/@watch'
// 'ui_state_management/application_state_management/@storageLink/@storageLink',
// 'ui_state_management/application_state_management/@storageProp/@storageProp',
// 'ui_state_management/application_state_management/appStorage/appStorage',
// 'ui_state_management/application_state_management/localStorage/localStorage',
// 'ui_state_management/inner_struct_state_management/@link/@link',
// 'ui_state_management/inner_struct_state_management/@prop/@prop',
// 'ui_state_management/others/@consume_@provide/@consume_@provide',
// 'ui_state_management/others/@observed_@objectLink/@observed_@objectLink',
// 'ui_state_management/others/@watch/@watch'
];
export const UT_PARTIAL_UPFATE_PAGES: string[] = [
'import/import@CustomDialog',
'import/import@Observed',
'import/importAllEts',
'import/importEts',
'import/importExportEts',
'import/importExportNest',
'import/importTs',
// 'import/import@CustomDialog',
// 'import/import@Observed',
// 'import/importAllEts',
// 'import/importEts',
// 'import/importExportEts',
// 'import/importExportNest',
// 'import/importTs',
'inner_component_transform/$$_component/$$_component',
'inner_component_transform/$$_component/$$_componentCheck1',
'inner_component_transform/$$_component/$$_componentCheck2',
'inner_component_transform/$$_component/$$_componentCheck3',
'inner_component_transform/$$_component/$$_componentCheck4',
'inner_component_transform/$$_component/$$_componentCheck5',
'inner_component_transform/$$_component/$$_componentCheck6',
'inner_component_transform/$$_component/$$_componentCheck7',
'inner_component_transform/$$_component/$$_componentCheck8',
'inner_component_transform/$$_component/$$_componentCheck9',
'inner_component_transform/$$_component/$$_if_elseIf_else',
'inner_component_transform/custom_component/component_object',
'inner_component_transform/custom_component/custom_component',
'inner_component_transform/gesture_component/GestureModeParallel',
'inner_component_transform/gesture_component/longPressGesture',
'inner_component_transform/gesture_component/panGestrue',
'inner_component_transform/gesture_component/pinchGesture',
'inner_component_transform/gesture_component/rotationGesture',
'inner_component_transform/gesture_component/swipeGesture',
'inner_component_transform/gesture_component/tapGesture',
'inner_component_transform/render_component/foreach/foreach',
'inner_component_transform/render_component/foreach/forEachSecondFunction',
'inner_component_transform/render_component/foreach/forEachThreeParam',
'inner_component_transform/render_component/foreach/forEachTwo',
'inner_component_transform/render_component/if/id_if',
'inner_component_transform/render_component/if/if',
'inner_component_transform/render_component/item/GridItem',
'inner_component_transform/render_component/item/ListItem',
'inner_component_transform/render_component/lazyforeach/lazyforeach',
'inner_component_transform/render_component/lazyforeach/lazyforEachThreeParam',
'inner_component_transform/render_component/repeat/repeat',
'inner_component_transform/render_component/repeat/repeatAttr',
'inner_component_transform/render_component/repeat/repeatVirtualScroll',
'inner_component_transform/render_component/tab/tab',
'inner_component_transform/simple_component/button/button',
'inner_component_transform/simple_component/xcomponent/XComponentContainer',
'inner_component_transform/transition_component/animateTo/animateTo',
'inner_component_transform/transition_component/navDestination_component/navDestination_component',
'inner_component_transform/transition_component/navigation/navigation_component',
'inner_component_transform/transition_component/pageTransition/pageTransition',
// 'inner_component_transform/$$_component/$$_component',
// 'inner_component_transform/$$_component/$$_componentCheck1',
// 'inner_component_transform/$$_component/$$_componentCheck2',
// 'inner_component_transform/$$_component/$$_componentCheck3',
// 'inner_component_transform/$$_component/$$_componentCheck4',
// 'inner_component_transform/$$_component/$$_componentCheck5',
// 'inner_component_transform/$$_component/$$_componentCheck6',
// 'inner_component_transform/$$_component/$$_componentCheck7',
// 'inner_component_transform/$$_component/$$_componentCheck8',
// 'inner_component_transform/$$_component/$$_componentCheck9',
// 'inner_component_transform/$$_component/$$_if_elseIf_else',
// 'inner_component_transform/custom_component/component_object',
// 'inner_component_transform/custom_component/custom_component',
// 'inner_component_transform/gesture_component/GestureModeParallel',
// 'inner_component_transform/gesture_component/longPressGesture',
// 'inner_component_transform/gesture_component/panGestrue',
// 'inner_component_transform/gesture_component/pinchGesture',
// 'inner_component_transform/gesture_component/rotationGesture',
// 'inner_component_transform/gesture_component/swipeGesture',
// 'inner_component_transform/gesture_component/tapGesture',
// 'inner_component_transform/render_component/foreach/foreach',
// 'inner_component_transform/render_component/foreach/forEachSecondFunction',
// 'inner_component_transform/render_component/foreach/forEachThreeParam',
// 'inner_component_transform/render_component/foreach/forEachTwo',
// 'inner_component_transform/render_component/if/id_if',
// 'inner_component_transform/render_component/if/if',
// 'inner_component_transform/render_component/item/GridItem',
// 'inner_component_transform/render_component/item/ListItem',
// 'inner_component_transform/render_component/lazyforeach/lazyforeach',
// 'inner_component_transform/render_component/lazyforeach/lazyforEachThreeParam',
// 'inner_component_transform/render_component/repeat/repeat',
// 'inner_component_transform/render_component/repeat/repeatAttr',
// 'inner_component_transform/render_component/repeat/repeatVirtualScroll',
// 'inner_component_transform/render_component/tab/tab',
// 'inner_component_transform/simple_component/button/button',
// 'inner_component_transform/simple_component/xcomponent/XComponentContainer',
// 'inner_component_transform/transition_component/animateTo/animateTo',
// 'inner_component_transform/transition_component/navDestination_component/navDestination_component',
// 'inner_component_transform/transition_component/navigation/navigation_component',
// 'inner_component_transform/transition_component/pageTransition/pageTransition',
'render_decorator/@AnimatableExtend/animatableExtend',
'render_decorator/@builder/@builder',
'render_decorator/@builder/@builderDynamicUsage$$',
'render_decorator/@builder/@builderOrComponentAsName',
'render_decorator/@builder/@builderSimplifyAfferent',
'render_decorator/@builder/@builderTransFormFirst',
'render_decorator/@builder/@builderTransFormFourth',
'render_decorator/@builder/@builderTransFormSecond',
'render_decorator/@builder/@builderTransFormThird',
'render_decorator/@builder/@builderVisilibity$$',
'render_decorator/@builder/@builderWithComponent',
'render_decorator/@builder/@builderWithForEach',
'render_decorator/@builder/@builderWithLinkData',
'render_decorator/@builder/handleCustomBuilder',
'render_decorator/@builderParam/@builderParam',
'render_decorator/@builderParam/@builderParamQuestionMark',
'render_decorator/@builderParam/@BuilderParamReturnType',
'render_decorator/@componentParent/@componentParent',
'render_decorator/@customDialog/@customDialog',
'render_decorator/@extend/@extend',
'render_decorator/@localBuilder/@localBuilder',
'render_decorator/@preview/@preview',
'render_decorator/@recycle/recycle_$$component',
'render_decorator/@recycle/recycle_extend_styles',
'render_decorator/@recycle/recycle_function_array',
'render_decorator/@recycle/recycle_gesture',
'render_decorator/@recycle/recycle_reuseId',
'render_decorator/@recycle/recycle',
'render_decorator/@styles/@styles',
'render_decorator/@styles/@stylesExport',
'render_decorator/@styles/@stylesOrComponentAsName',
// 'render_decorator/@AnimatableExtend/animatableExtend',
// 'render_decorator/@builder/@builder',
// 'render_decorator/@builder/@builderDynamicUsage$$',
// 'render_decorator/@builder/@builderOrComponentAsName',
// 'render_decorator/@builder/@builderSimplifyAfferent',
// 'render_decorator/@builder/@builderTransFormFirst',
// 'render_decorator/@builder/@builderTransFormFourth',
// 'render_decorator/@builder/@builderTransFormSecond',
// 'render_decorator/@builder/@builderTransFormThird',
// 'render_decorator/@builder/@builderVisilibity$$',
// 'render_decorator/@builder/@builderWithComponent',
// 'render_decorator/@builder/@builderWithForEach',
// 'render_decorator/@builder/@builderWithLinkData',
// 'render_decorator/@builder/handleCustomBuilder',
// 'render_decorator/@builderParam/@builderParam',
// 'render_decorator/@builderParam/@builderParamQuestionMark',
// 'render_decorator/@builderParam/@BuilderParamReturnType',
// 'render_decorator/@componentParent/@componentParent',
// 'render_decorator/@customDialog/@customDialog',
// 'render_decorator/@extend/@extend',
// 'render_decorator/@localBuilder/@localBuilder',
// 'render_decorator/@preview/@preview',
// 'render_decorator/@recycle/recycle_$$component',
// 'render_decorator/@recycle/recycle_extend_styles',
// 'render_decorator/@recycle/recycle_function_array',
// 'render_decorator/@recycle/recycle_gesture',
// 'render_decorator/@recycle/recycle_reuseId',
// 'render_decorator/@recycle/recycle',
// 'render_decorator/@styles/@styles',
// 'render_decorator/@styles/@stylesExport',
// 'render_decorator/@styles/@stylesOrComponentAsName',
'ui_context/build_ui_in_correct_place',
// 'ui_context/build_ui_in_correct_place',
'ui_state_management/application_state_management/@storageLink/@storageLink',
'ui_state_management/application_state_management/@storageProp/@storageProp',
'ui_state_management/application_state_management/appStorage/appStorage',
'ui_state_management/application_state_management/localStorage/localStorage',
'ui_state_management/application_state_management/localStorage/localStorageForBoth',
'ui_state_management/application_state_management/localStorage/localStorageForChainCall',
'ui_state_management/application_state_management/localStorage/localStorageForRoute',
'ui_state_management/application_state_management/localStorage/localStorageForStorage',
'ui_state_management/application_state_management/localStorage/localStorageForThree',
'ui_state_management/application_state_management/localStorage/localStorageForThreeParam',
'ui_state_management/application_state_management/localStorage/localStorageParam',
'ui_state_management/inner_struct_state_management/@link/@link',
'ui_state_management/inner_struct_state_management/@objectLink/@objectLink',
'ui_state_management/inner_struct_state_management/@prop/@prop',
'ui_state_management/inner_struct_state_management/@prop/@propComplexType',
'ui_state_management/inner_struct_state_management/@state/@state',
'ui_state_management/others/@consume_@provide/@consume_@provide',
'ui_state_management/others/@observed_@objectLink/@observed_@objectLink',
'ui_state_management/others/@watch/@watch',
'ui_state_management/others/decoratorKeyCheck/decoratorKeyCheck',
// 'ui_state_management/application_state_management/@storageLink/@storageLink',
// 'ui_state_management/application_state_management/@storageProp/@storageProp',
// 'ui_state_management/application_state_management/appStorage/appStorage',
// 'ui_state_management/application_state_management/localStorage/localStorage',
// 'ui_state_management/application_state_management/localStorage/localStorageForBoth',
// 'ui_state_management/application_state_management/localStorage/localStorageForChainCall',
// 'ui_state_management/application_state_management/localStorage/localStorageForRoute',
// 'ui_state_management/application_state_management/localStorage/localStorageForStorage',
// 'ui_state_management/application_state_management/localStorage/localStorageForThree',
// 'ui_state_management/application_state_management/localStorage/localStorageForThreeParam',
// 'ui_state_management/application_state_management/localStorage/localStorageParam',
// 'ui_state_management/inner_struct_state_management/@link/@link',
// 'ui_state_management/inner_struct_state_management/@objectLink/@objectLink',
// 'ui_state_management/inner_struct_state_management/@prop/@prop',
// 'ui_state_management/inner_struct_state_management/@prop/@propComplexType',
// 'ui_state_management/inner_struct_state_management/@state/@state',
// 'ui_state_management/others/@consume_@provide/@consume_@provide',
// 'ui_state_management/others/@observed_@objectLink/@observed_@objectLink',
// 'ui_state_management/others/@watch/@watch',
// 'ui_state_management/others/decoratorKeyCheck/decoratorKeyCheck',
'v2_component_decorator/builderParamStyles',
'v2_component_decorator/param_event_twoway_binding',
'v2_component_decorator/staticComponentMember'
// 'v2_component_decorator/builderParamStyles',
// 'v2_component_decorator/param_event_twoway_binding',
// 'v2_component_decorator/staticComponentMember'
];
export const UT_VALIDATE_PAGES: string[] = [
@ -186,7 +186,7 @@ export const UT_VALIDATE_PAGES: string[] = [
// 'Decorators/process_component_member/validateHasIllegalDecoratorInEntry',
// 'Decorators/process_component_member/validateHasIllegalQuestionToken',
// 'Decorators/process_component_member/validateMultiDecorators',
// 'Decorators/process_component_member/validateNonObservedClassType', //111
// 'Decorators/process_component_member/validateNonObservedClassType', //222
// 'Decorators/process_component_member/validatePropertyDefaultValue',
// 'Decorators/process_component_member/validatePropertyNonDefaultValue',
// 'Decorators/process_component_member/validatePropertyNonType',
@ -196,11 +196,11 @@ export const UT_VALIDATE_PAGES: string[] = [
// 'Decorators/process_custom_component/checkBuilder$$', //111
// 'Decorators/process_custom_component/v2DecoratorInitFromParent',
// 'Decorators/process_custom_component/validateForbiddenToInitViaParam',
// 'Decorators/process_custom_component/validateIllegalInitFromParent', //111
// 'Decorators/process_custom_component/validateIllegalInitFromParent', //222
// 'Decorators/process_custom_component/validateInitDecorator',
// 'Decorators/process_custom_component/validateMandatoryToInitViaParam',
// 'Decorators/process_custom_component/validateNonLinkWithDollar',
// 'Decorators/process_custom_component/validateParamTwoWayBind', //111
// 'Decorators/process_custom_component/validateParamTwoWayBind', //222
// 'Decorators/process_import/validateModuleName',
@ -217,16 +217,16 @@ export const UT_VALIDATE_PAGES: string[] = [
// 'Decorators/process_ui_syntax/UnknownSrcName',
// 'Decorators/process_ui_syntax/UnknownSrcType',
// 'Decorators/v1AndV2ComponentDecorators/property_observe_validate', //111
// 'Decorators/v1AndV2ComponentDecorators/v1ToV2Component', //111
// 'Decorators/v1AndV2ComponentDecorators/v1ToV2ComponentValidate', //111
// 'Decorators/v1AndV2ComponentDecorators/v2ToV1ComponentValidate', //111
// 'Decorators/v1AndV2ComponentDecorators/property_observe_validate', //222
// 'Decorators/v1AndV2ComponentDecorators/v1ToV2Component', //222
// 'Decorators/v1AndV2ComponentDecorators/v1ToV2ComponentValidate', //222
// 'Decorators/v1AndV2ComponentDecorators/v2ToV1ComponentValidate', //222
// 'Decorators/v1AndV2ComponentDecorators/v2ToV1Link',
// 'Decorators/vaildate_ui_syntax/@localBuilder',
// 'Decorators/vaildate_ui_syntax/@Monitor',
// 'Decorators/vaildate_ui_syntax/@Trace',
// 'Decorators/vaildate_ui_syntax/@Type',
'Decorators/vaildate_ui_syntax/@Type', //222
// 'Decorators/vaildate_ui_syntax/componentV2BothWithComponent',
// 'Decorators/vaildate_ui_syntax/ExceededEntry',
// 'Decorators/vaildate_ui_syntax/ExceededPreview',

View File

@ -70,7 +70,7 @@ mocha.describe('test UT testcases [non-preview mode]', function () {
this.globalProjectConfig.setIgnoreWarning(true);
this.globalProjectConfig.scan(PROJECT_ROOT, DEFAULT_PROJECT, MAIN_PAGES);
this.globalProjectConfig.mockCompileContextInfo(`${PROJECT_ROOT}/${DEFAULT_PROJECT}`, MAIN_PAGES);
this.globalProjectConfig.concat(RollUpPluginMock.mockArkProjectConfig(PROJECT_ROOT, DEFAULT_PROJECT, true));
this.globalProjectConfig.concat(RollUpPluginMock.mockArkProjectConfig(PROJECT_ROOT, DEFAULT_PROJECT, false));
this.rollup.share.projectConfig.concat(this.globalProjectConfig);
Object.assign(projectConfig, this.globalProjectConfig);

View File

@ -76,7 +76,7 @@ mocha.describe('test UT for validate testcases [non-preview mode]', function ()
this.globalProjectConfig.setIgnoreWarning(true);
this.globalProjectConfig.scan(PROJECT_ROOT, DEFAULT_PROJECT, MAIN_PAGES);
this.globalProjectConfig.mockCompileContextInfo(`${PROJECT_ROOT}/${DEFAULT_PROJECT}`, MAIN_PAGES);
this.globalProjectConfig.concat(RollUpPluginMock.mockArkProjectConfig(PROJECT_ROOT, DEFAULT_PROJECT, true));
this.globalProjectConfig.mockCompileContextInfo(`${PROJECT_ROOT}/${DEFAULT_PROJECT}`, MAIN_PAGES);
this.rollup.share.projectConfig.concat(this.globalProjectConfig);
Object.assign(projectConfig, this.globalProjectConfig);
@ -137,11 +137,12 @@ mocha.describe('test UT for validate testcases [non-preview mode]', function ()
UT_VALIDATE_PAGES.forEach((utPage, index) => {
mocha.it(`1-${index + 1}: test ${utPage}`, function (done) {
const transform = this.etsTransformPlugin.transform.bind(this.rollup);
const sourceFilePath: string = path.resolve(TEST_CASES_PATH, `utForValidate/${utPage}.ets`);
const sourceCode: string = fs.readFileSync(sourceFilePath, 'utf-8');
storedFileInfo.addFileCacheInfo(sourceFilePath);
const transform = this.etsTransformPlugin.transform.bind(this.rollup);
const errorCollection: object = JSON.parse(fs.readFileSync(ERROR_COLLECTION_PATH, 'utf-8'));
const errorKey: string = parseFileNameFromPath(sourceFilePath);
const errorVals: object = errorCollection[errorKey] ?? {};