mirror of
https://gitee.com/openharmony/developtools_ace_ets2bundle
synced 2024-12-04 07:22:30 +00:00
fix @Type ut has no error Signed-off-by: s00912778 <shijiakai2@huawei.com> Change-Id: Id8e57b1f7c7f8777eb01db5de0d7a4b7cb8c723c
This commit is contained in:
parent
7a33a5b9c1
commit
e93e60cec7
@ -296,7 +296,28 @@
|
||||
"type": "ERROR"
|
||||
}
|
||||
],
|
||||
"@Type": [],
|
||||
"@Type": [
|
||||
{
|
||||
"message": "The '@Type' decorator can only be used in 'class'.",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"message": "The '@Type' decorator can not be used in a 'class' decorated with Sendable.",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"message": "The '@Type' can decorate only member variables in a 'class'.",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"message": "The '@Type' decorator can not be used in a 'class' decorated with Observed.",
|
||||
"type": "ERROR"
|
||||
},
|
||||
{
|
||||
"message": "The '@Type' can decorate only member variables in a 'class'.",
|
||||
"type": "ERROR"
|
||||
}
|
||||
],
|
||||
"validate_track_observed": [
|
||||
{
|
||||
"message": "The struct 'child' use invalid decorator.",
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Type } from '../../../test/import@ohosArkuiStateManagement';
|
||||
import { Type } from '@ohos.arkui.StateManagement';
|
||||
|
||||
class A {
|
||||
p: number = 1;
|
||||
|
@ -18,4 +18,23 @@ export function scanFiles(filepath: string, fileList: Set<string>) {
|
||||
fileList.add(child);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export function scanFileNames(filepath: string, fileList: Set<string>) {
|
||||
if (!fs.existsSync(filepath)) {
|
||||
return;
|
||||
}
|
||||
const files = fs.readdirSync(filepath);
|
||||
files.forEach((file) => {
|
||||
const child = path.join(filepath, file);
|
||||
const stat = fs.statSync(child);
|
||||
if (stat.isDirectory()) {
|
||||
scanFiles(child, fileList);
|
||||
} else {
|
||||
if (child.includes("mock")) {
|
||||
return;
|
||||
}
|
||||
fileList.add(path.basename(child));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -19,12 +19,14 @@ import {
|
||||
resetUtils,
|
||||
storedFileInfo
|
||||
} from '../../lib/utils';
|
||||
import {
|
||||
import main, {
|
||||
partialUpdateConfig,
|
||||
projectConfig,
|
||||
resetGlobalProgram,
|
||||
resetMain,
|
||||
resources
|
||||
resources,
|
||||
sdkConfigs,
|
||||
systemModules
|
||||
} from '../../main';
|
||||
import {
|
||||
etsChecker
|
||||
@ -49,13 +51,20 @@ import {
|
||||
processExecInStr,
|
||||
sourceReplace
|
||||
} from './helpers/parser';
|
||||
import {
|
||||
scanFileNames
|
||||
} from './helpers/utils';
|
||||
|
||||
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 MAIN_PAGES: string[] = UT_VALIDATE_PAGES.map((p) => `pages/utForValidate/${p}`);
|
||||
|
||||
const systemModuleSet: Set<string> = new Set();
|
||||
scanFileNames(SYS_CONFIG_PATH, systemModuleSet);
|
||||
|
||||
mocha.describe('test UT for validate testcases [non-preview mode]', function () {
|
||||
this.timeout(10000);
|
||||
|
||||
@ -84,9 +93,21 @@ mocha.describe('test UT for validate testcases [non-preview mode]', function ()
|
||||
this.globalPartialUpdateConfig = new PartialUpdateConfig();
|
||||
this.globalPartialUpdateConfig.setPartialUpdateMode(true);
|
||||
this.globalPartialUpdateConfig.mockDisableArkTSLinter();
|
||||
|
||||
Object.assign(partialUpdateConfig, this.globalPartialUpdateConfig);
|
||||
|
||||
Object.assign(main, {
|
||||
sdkConfigs: [
|
||||
...sdkConfigs
|
||||
.filter((sdkConfig) => !sdkConfig['apiPath'].includes(SYS_CONFIG_PATH))
|
||||
.map((sdkConfig) => {
|
||||
sdkConfig['apiPath'].push(SYS_CONFIG_PATH);
|
||||
return sdkConfig;
|
||||
}
|
||||
),
|
||||
],
|
||||
systemModules: [...systemModules, ...systemModuleSet]
|
||||
});
|
||||
|
||||
this.etsCheckerPlugin = etsChecker();
|
||||
this.etsTransformPlugin = etsTransform();
|
||||
|
||||
@ -189,8 +210,8 @@ mocha.describe('test UT for validate testcases [non-preview mode]', function ()
|
||||
warnMsgs.forEach((err) => {
|
||||
const logInfo: string = parseLog(err);
|
||||
|
||||
console.error(`1-${index}: logInfo: `, logInfo);
|
||||
console.error(`1-${index}: expectWarnMsgs: `, JSON.stringify(expectWarnMsgs));
|
||||
// console.error(`1-${index}: logInfo: `, logInfo);
|
||||
// console.error(`1-${index}: expectWarnMsgs: `, JSON.stringify(expectWarnMsgs));
|
||||
expect(expectWarnMsgs.includes(logInfo)).to.be.true;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user