diff --git a/ace-loader/package.json b/ace-loader/package.json
index 929550f..144c452 100644
--- a/ace-loader/package.json
+++ b/ace-loader/package.json
@@ -16,7 +16,11 @@
"rich": "cd sample/rich && webpack --config ../../webpack.rich.config.js",
"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"
+ "postinstall": "node npm-install.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",
diff --git a/ace-loader/test/lite/test.js b/ace-loader/test/lite/test.js
index 92344f1..9024dec 100644
--- a/ace-loader/test/lite/test.js
+++ b/ace-loader/test/lite/test.js
@@ -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;
}
diff --git a/ace-loader/test/rich/expected/privateAttr.js b/ace-loader/test/rich/expected/privateAttr.js
index 0ed854b..3afffe0 100644
--- a/ace-loader/test/rich/expected/privateAttr.js
+++ b/ace-loader/test/rich/expected/privateAttr.js
@@ -468,8 +468,10 @@
},
{
"type": "xcomponent",
+ "id": "1",
"attr": {
"debugLine": "pages/privateAttr/privateAttr:130",
+ "id": "1",
"name": "function () {return this.name}",
"type": "texture"
}
diff --git a/ace-loader/test/rich/testcase/pages/privateAttr/privateAttr.hml b/ace-loader/test/rich/testcase/pages/privateAttr/privateAttr.hml
index 701d117..6790f13 100644
--- a/ace-loader/test/rich/testcase/pages/privateAttr/privateAttr.hml
+++ b/ace-loader/test/rich/testcase/pages/privateAttr/privateAttr.hml
@@ -127,7 +127,7 @@
-
+
diff --git a/ace-loader/webpack.rich.config.js b/ace-loader/webpack.rich.config.js
index afb813e..7099b8a 100644
--- a/ace-loader/webpack.rich.config.js
+++ b/ace-loader/webpack.rich.config.js
@@ -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';
}