keep both npm run test and npm run etsTest

Signed-off-by: s00912778 <shijiakai2@huawei.com>
Change-Id: I2303d24cd2b2990b4272fe81cfeae37d09e37e8a
This commit is contained in:
s00912778 2024-10-25 14:38:51 +08:00
parent 6d531814ef
commit 75adf806c6
5 changed files with 1040 additions and 270 deletions

View File

@ -31,18 +31,14 @@
{
"message": "Then statement cannot be null in if statement.",
"type": "ERROR"
},
{
"message": "'' does not meet UI component syntax.",
"type": "ERROR"
}
],
"idCheck": {
"message": "The current component id \"1\" is duplicate with ${const path = require('path');path.resolve(__dirname, '../../../test/transform_ut/application/entry/src/main/ets/pages/utForValidate/Decorators/process_component_build/idCheck.ets')}:6:21.",
"message": "The current component id \"1\" is duplicate with ${path.resolve(__dirname, '../idCheck.ets')}:7:21.",
"type": "WARN"
},
"arkUIStandard": {
"message": "'Text('Hello').onClick' does not meet UI component syntax.",
"message": "'Text('Hello').onCilck' does not meet UI component syntax.",
"type": "ERROR"
},
"stateStyles": {
@ -54,7 +50,7 @@
"type": "ERROR"
},
"attributeCheck": {
"message": "'ForEach(this.arr, () =>{}, (item: string) => item).h' does not meet UI component syntax.",
"message": "'ForEach(this.arr, () =>{}, this.arr[0]).h' does not meet UI component syntax.",
"type": "ERROR"
},
"validateDecorators": {
@ -74,7 +70,7 @@
"type": "ERROR"
},
"validateBuildMethodCount": {
"message": "struct 'ValidateBuildMethodCountIndex' must be at least or at most one 'build' method.Solutions:>A structurally modified page must have at least one and no more than one'build' method.",
"message": "struct 'Index' must be at least or at most one 'build' method.Solutions:>A structurally modified page must have at least one and no more than one'build' method.",
"type": "ERROR"
},
"validateHasController": {
@ -82,7 +78,7 @@
"type": "ERROR"
},
"processWatch": {
"message": "Cannot find name 'onWatch' in struct 'ProcessWatchIndex'.",
"message": "Cannot find name 'onWatch' in struct 'Index'.",
"type": "ERROR"
},
"updateBuilderParamProperty": {
@ -110,7 +106,7 @@
"type": "ERROR"
},
"validateHasIllegalDecoratorInEntry": {
"message": "The @Entry component 'ValidateHasIllegalDecoratorInEntryIndex' cannot have the @Prop property 'message'.",
"message": "The @Entry component 'Index' cannot have the @Prop property 'message'.",
"type": "WARN"
},
"validateHasIllegalQuestionToken": {
@ -142,11 +138,11 @@
"type": "WARN"
},
"validateForbiddenToInitViaParam": {
"message": "Property 'message' in the custom component 'ValidateForbiddenToInitViaParamChild' cannot be initialized here (forbidden to specify).",
"message": "Property 'message' in the custom component 'Child' cannot be initialized here (forbidden to specify).",
"type": "ERROR"
},
"validateMandatoryToInitViaParam": {
"message": "Property 'message' in the custom component 'ValidateMandatoryToInitViaParamChild' is missing (mandatory to specify).",
"message": "Property 'message' in the custom component 'Child' is missing (mandatory to specify).",
"type": "ERROR"
},
"validateInitDecorator": [
@ -183,16 +179,10 @@
"message": "The module name 'Button' can not be the same as the inner component name.",
"type": "ERROR"
},
"notComponent": [
{
"message": "Decorator '@Component', '@ComponentV2', or '@CustomDialog' is missing for struct 'EntryComponent'.",
"type": "ERROR"
},
{
"message": "A page configured in 'main_pages.json or build-profile.json5' must have one and only one '@Entry' decorator.Solutions:>Please make sure that the splash page has one and only one '@Entry' decorator.",
"type": "ERROR"
}
],
"notComponent": {
"message": "Decorator '@Component', '@ComponentV2', or '@CustomDialog' is missing for struct 'EntryComponent'.",
"type": "ERROR"
},
"notConcurrent": {
"message": "The struct 'NotConcurrentIndexDecorator' use invalid decorator.",
"type": "WARN"
@ -285,18 +275,12 @@
"message": "A page can contain at most 10 '@Preview' decorators.",
"type": "ERROR"
},
"ExceededEntry": [
{
"message": "A page can't contain more than one '@Entry' decorator",
"type": "ERROR"
},
{
"message": "A page configured in 'main_pages.json or build-profile.json5' must have one and only one '@Entry' decorator.Solutions:>Please make sure that the splash page has one and only one '@Entry' decorator.",
"type": "ERROR"
}
],
"ExceededEntry": {
"message": "A page can't contain more than one '@Entry' decorator",
"type": "ERROR"
},
"OneEntry": {
"message": "A page configured in 'main_pages.json or build-profile.json5' must have one and only one '@Entry' decorator.Solutions:>Please make sure that the splash page has one and only one '@Entry' decorator.",
"message": "A page configured in 'undefined or build-profile.json5' must have one and only one '@Entry' decorator.Solutions:>Please make sure that the splash page has one and only one '@Entry' decorator.",
"type": "ERROR"
},
"notMethodDeco": {
@ -797,216 +781,8 @@
"type": "ERROR"
}
],
"v1ToV2Component": [
{
"message": "Property 'func_value1' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'func_value2' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
}
],
"v1ToV2ComponentValidate": [
{
"message": "The type of the @Param property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "Property 'param_value' in the @ComponentV2 component 'TestV2Child2' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'param_value_alias_type' in the @ComponentV2 component 'TestV2Child2' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'state_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'prop_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'link_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'provide_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'consume_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'objectLink_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'storage_link_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'storage_prop_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'local_storage_link_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'local_storage_prop_value' in the @ComponentV2 component 'TestV2Child' are not allowed to be assigned values here.",
"type": "ERROR"
}
],
"v2ToV1ComponentValidate": [
{
"message": "The type of the @Provider property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The @ComponentV2 struct must not contain any @Component with an @Link decorated variable",
"type": "ERROR"
},
{
"message": "Property 'set_value' in the @Component component 'TestV1Child1' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'set_value_alias' in the @Component component 'TestV1Child1' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "The @ComponentV2 struct must not contain any @Component with an @Link decorated variable",
"type": "ERROR"
},
{
"message": "Property 'set_value' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'map_value' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'arr_value' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'arr_value1' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'arr_value2' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
},
{
"message": "Property 'arr_value3' in the @Component component 'TestV1Child' are not allowed to be assigned values here.",
"type": "ERROR"
}
],
"property_observe_validate": [
{
"message": "The type of the @State property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @State property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @State property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @State property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @State property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @Prop property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @Link property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @Provide property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @Consume property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @StorageLink property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @StorageProp property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @LocalStorageLink property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @LocalStorageProp property can not be a class decorated with @ObservedV2.",
"type": "ERROR"
},
{
"message": "The type of the @Local property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Local property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Local property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Local property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Local property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Local property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Param property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Param property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Param property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Event property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Provider property can not be a class decorated with @Observed.",
"type": "ERROR"
},
{
"message": "The type of the @Consumer property can not be a class decorated with @Observed.",
"type": "ERROR"
}
]
"v1ToV2Component.ts": [],
"v1ToV2ComponentValidate": [],
"v2ToV1ComponentValidate": [],
"property_observe_validate": []
}

View File

@ -5,7 +5,7 @@ import sinon from 'sinon';
import { expect } from 'chai';
import {
BUILD_ON,
BUILD_ON,
} from '../../lib/pre_define';
import {
resetComponentCollection,

View File

@ -5,19 +5,19 @@ import sinon from 'sinon';
import { expect } from 'chai';
import {
BUILD_ON
BUILD_ON
} from '../../lib/pre_define';
import {
resetComponentCollection,
componentCollection
componentCollection
} from '../../lib/validate_ui_syntax';
import {
transformLog
} from '../../lib/process_ui_syntax';
import {
componentInfo,
resetUtils,
storedFileInfo
componentInfo,
resetUtils,
storedFileInfo
} from '../../lib/utils';
import {
partialUpdateConfig,
@ -140,8 +140,6 @@ mocha.describe('test UT for partial update testcases [non-preview mode]', functi
transform(sourceReplace(sourceCode), sourceFilePath)
.then(res => {
// console.error(`1-${index}: result: `, res.code);
expect(parseCode(res.code)).eql(parseCode(targetCode));
done();
})

View File

@ -63,7 +63,7 @@ const PROJECT_ROOT: string = path.resolve(__dirname, '../../test/transform_ut');
const DEFAULT_PROJECT: string = 'application';
const TEST_CASES_PATH: string = path.resolve(PROJECT_ROOT, DEFAULT_PROJECT, 'entry/src/main/ets/pages');
const SYS_CONFIG_PATH: string = path.resolve(PROJECT_ROOT, DEFAULT_PROJECT, 'entry/src/main/ets/test/common');
const ERROR_COLLECTION_PATH: string = path.resolve(__dirname, '../../test/error.json');
const ERROR_COLLECTION_PATH: string = path.resolve(__dirname, '../../test/transform_ut_error.json');
const MAIN_PAGES: string[] = [
...UT_VALIDATE_PAGES,
...UT_VALIDATE_PAGES_PREVIEW,
@ -199,32 +199,16 @@ mocha.describe('test UT for validate testcases [non-preview mode]', function ()
const warnMsgs: string[] = logger.getWarnMsgs();
const infoMsgs: string[] = logger.getInfoMsgs();
// console.error(`1-${index}: errorMsgs: `, JSON.stringify(errorMsgs));
// console.error(`1-${index}: expectErrorMsgs: `, JSON.stringify(expectErrorMsgs));
// console.error(`1-${index}: errorMsgs.length: ${errorMsgs.length}, expectErrorMsgs.length: ${expectErrorMsgs.length}`);
// console.error(`1-${index}: warnMsgs.length: ${warnMsgs.length}, expectWarnMsgs.length: ${expectWarnMsgs.length}`);
expect(errorMsgs.length === expectErrorMsgs.length).to.be.true;
expect(warnMsgs.length === expectWarnMsgs.length).to.be.true;
// console.error(`1-${index}: errorMsgs: `, JSON.stringify(errorMsgs));
// console.error(`1-${index}: warnMsgs: `, JSON.stringify(warnMsgs));
// console.error(`1-${index}: infoMsgs: `, JSON.stringify(infoMsgs));
errorMsgs.forEach((err) => {
const logInfo: string = parseLog(err);
// console.error(`1-${index}: logInfo: `, logInfo);
// console.error(`1-${index}: expectErrorMsgs: `, JSON.stringify(expectErrorMsgs));
expect(expectErrorMsgs.includes(logInfo)).to.be.true;
});
warnMsgs.forEach((err) => {
const logInfo: string = parseLog(err);
// console.error(`1-${index}: logInfo: `, logInfo);
// console.error(`1-${index}: expectWarnMsgs: `, JSON.stringify(expectWarnMsgs));
expect(expectWarnMsgs.includes(logInfo)).to.be.true;
});

File diff suppressed because it is too large Load Diff