update ut

Signed-off-by: houhaoyu <houhaoyu@huawei.com>
Change-Id: Idc55ed099fb4cc0040f1078116d7a8b7b74adfd7
This commit is contained in:
houhaoyu
2022-01-20 16:05:44 +08:00
parent 96b74b3657
commit c013e82883
3 changed files with 9 additions and 2 deletions
+4 -1
View File
@@ -17,7 +17,10 @@
"lite": "cd sample/lite && webpack --config ../../webpack.lite.config.js",
"card": "cd sample/card && webpack --config ../../webpack.rich.config.js",
"postinstall": "node npm-install.js",
"richtest": "npm run build && cd test/rich/testcase && webpack --config ../../../webpack.rich.config.js && mocha ../test.js"
"richtest": "cd test/rich/testcase && webpack --config ../../../webpack.rich.config.js && mocha ../test.js",
"litetest": "cd test/lite/testcase && webpack --config ../../../webpack.lite.config.js && mocha ../test.js",
"cardtest": "cd test/card/testcase && webpack --env utTestForCard --config ../../../webpack.rich.config.js && mocha ../test.js",
"test": "npm run build && npm run richtest && npm run litetest && npm run cardtest"
},
"devDependencies": {
"chai": "^3.5.0",
+2 -1
View File
@@ -33,9 +33,10 @@ function getJsBundle(componentName) {
}
function getExpectedObj(componentName) {
const matchHashComment = /\/\*(.|\n|\r)+\*\//;
const filepath = path.join(__dirname, "expected", `${componentName}.js`);
const expectedContent = fs.readFileSync(filepath, "utf-8");
const expectedObj = JSON.parse(expectedContent.toString());
const expectedObj = JSON.parse(expectedContent.toString().replace(matchHashComment, ''));
return expectedObj;
}
+3
View File
@@ -178,6 +178,9 @@ let config = {
}
function setConfigs(env) {
if (env.utTestForCard) {
env.DEVICE_LEVEL = "card";
}
if (process.env.aceModuleJsonPath || env.aceModuleJsonPath) {
process.env.compileMode = 'moduleJson';
}