@aiot-toolkit/parser 2.0.6-beta.10 → 2.0.6-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,7 +5,7 @@ export default interface IE2eConfig {
5
5
  /**
6
6
  * 测试文件的目录
7
7
  *
8
- * 绝对路径或相对config文件的路径
8
+ * 绝对路径 或 相对config文件的路径
9
9
  *
10
10
  * @default "test"
11
11
  */
@@ -13,8 +13,13 @@ export default interface IE2eConfig {
13
13
  /**
14
14
  * 测试模式打包,入口文件的在manifest中的名称
15
15
  */
16
- entry?: {
17
- name: string;
16
+ entry: {
17
+ /**
18
+ * 自动化测试文件路径:相对config文件的路径 或 绝对路径
19
+ *
20
+ * @example "pages/index"
21
+ */
22
+ path: string;
18
23
  launchMode?: string;
19
24
  };
20
25
  /**
@@ -87,6 +87,9 @@ function addAppTestCode(path) {
87
87
  * @param opts
88
88
  */
89
89
  function addPageTestCode(path, opts) {
90
+ if (!opts.compilerOption.e2eConfigPath) {
91
+ return;
92
+ }
90
93
  const e2eConfig = _UxUtil.default.getE2eConfig({
91
94
  projectPath: opts.options.projectPath,
92
95
  e2eConfigPath: opts.compilerOption.e2eConfigPath
@@ -50,7 +50,7 @@ declare class UxUtil {
50
50
  static importToTypescript(importList: IImportAst[], compilerOption: ITranslateOption): string[];
51
51
  static getE2eConfig(option: {
52
52
  projectPath: string;
53
- e2eConfigPath?: string;
53
+ e2eConfigPath: string;
54
54
  }): IE2eConfig;
55
55
  }
56
56
  export default UxUtil;
@@ -111,26 +111,26 @@ class UxUtil {
111
111
  }
112
112
  static getE2eConfig(option) {
113
113
  const defaultTestDir = 'test';
114
- let result = {
115
- dir: _path.default.join(option.projectPath, defaultTestDir)
116
- };
117
114
  const {
118
115
  projectPath,
119
116
  e2eConfigPath
120
117
  } = option;
121
- if (e2eConfigPath) {
122
- const configFilePath = _path.default.resolve(projectPath, e2eConfigPath);
123
- const configFileDir = _path.default.dirname(configFilePath);
124
- if (_fsExtra.default.existsSync(configFilePath)) {
125
- result = _fsExtra.default.readJSONSync(configFilePath, 'utf-8');
126
- if (result) {
127
- result.dir = _path.default.resolve(configFileDir, result.dir || defaultTestDir);
128
- }
129
- } else {
130
- throw new Error(`e2e Configuration file does not exist: ${configFilePath}`);
118
+ const configFilePath = _path.default.resolve(projectPath, e2eConfigPath);
119
+ const configFileDir = _path.default.dirname(configFilePath);
120
+ if (_fsExtra.default.existsSync(configFilePath)) {
121
+ const obj = _fsExtra.default.readJSONSync(configFilePath, 'utf-8');
122
+ const dir = _path.default.resolve(configFileDir, obj.dir || defaultTestDir);
123
+ if (!obj.entry) {
124
+ throw new Error(`e2e Configuration file error: missing entry field`);
131
125
  }
126
+ const result = {
127
+ ...obj,
128
+ dir
129
+ };
130
+ return result;
131
+ } else {
132
+ throw new Error(`e2e Configuration file does not exist: ${configFilePath}`);
132
133
  }
133
- return result;
134
134
  }
135
135
  }
136
136
  var _default = exports.default = UxUtil;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiot-toolkit/parser",
3
- "version": "2.0.6-beta.10",
3
+ "version": "2.0.6-beta.11",
4
4
  "description": "Parse the source code of aiot and convert it to the AST (Abstract Syntax Tree) of the target code.",
5
5
  "keywords": [
6
6
  "aiot",
@@ -20,7 +20,7 @@
20
20
  "test": "node ./__tests__/parser.test.js"
21
21
  },
22
22
  "dependencies": {
23
- "@aiot-toolkit/shared-utils": "2.0.6-beta.10",
23
+ "@aiot-toolkit/shared-utils": "2.0.6-beta.11",
24
24
  "@babel/core": "^7.23.6",
25
25
  "@babel/generator": "^7.24.10",
26
26
  "@babel/parser": "^7.24.8",
@@ -31,7 +31,7 @@
31
31
  "css-tree": "npm:aiot-css-tree@^2.3.1",
32
32
  "csstree-validator": "^3.0.0",
33
33
  "eslint": "^8.46.0",
34
- "file-lane": "2.0.6-beta.10",
34
+ "file-lane": "2.0.6-beta.11",
35
35
  "fs-extra": "^11.2.0",
36
36
  "google-protobuf": "^3.21.2",
37
37
  "less": "^4.2.0",
@@ -60,5 +60,5 @@
60
60
  "@types/tinycolor2": "^1.4.6",
61
61
  "babel-plugin-tester": "^11.0.4"
62
62
  },
63
- "gitHead": "b6a63385af95a6ba445e65225a92014026ce3144"
63
+ "gitHead": "acecf0ae5d6991619051dbbeda770a602f215dd6"
64
64
  }