apipost-cli 1.0.1 → 1.0.3

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.
package/bin/cli.js CHANGED
@@ -75,14 +75,16 @@ const runTestEvents = async (data, options) => {
75
75
  }
76
76
 
77
77
  // 外部数据文件
78
- try {
79
- let interData = await APTools.str2testDataAsync(fs.readFileSync(String(cliOption.iterationData), "utf-8"));
78
+ if (cliOption.iterationData != '') {
79
+ try {
80
+ let interData = await APTools.str2testDataAsync(fs.readFileSync(String(cliOption.iterationData), "utf-8"));
80
81
 
81
- if (_.isArray(interData)) {
82
- _.set(newOptions, 'option.iterationData', interData)
82
+ if (_.isArray(interData)) {
83
+ _.set(newOptions, 'option.iterationData', interData)
84
+ }
85
+ } catch (e) {
86
+ fs.appendFileSync(path.join(homedir, 'apipost-cli-error.log'), `${formattedTime}\t数据文件 ${String(cliOption.iterationData)} 不存在\n`);
83
87
  }
84
- } catch (e) {
85
- fs.appendFileSync(path.join(homedir, 'apipost-cli-error.log'), `${formattedTime}\t数据文件 ${String(cliOption.iterationData)} 不存在\n`);
86
88
  }
87
89
 
88
90
  // 设置发送相关选项参数
package/bin/template.js CHANGED
@@ -761,7 +761,6 @@ const RENDER_TEST_REPORT_HTML_STR = (data = {}) => {
761
761
  };
762
762
 
763
763
  const downloadTestReport = async (data, options, request) => {
764
- // console.log(options)
765
764
  const homedir = os.homedir();
766
765
  const now = dayjs();
767
766
  const formattedTime = now.format('YYYY-MM-DD HH:mm:ss');
@@ -781,6 +780,8 @@ const downloadTestReport = async (data, options, request) => {
781
780
  fs.writeFileSync(finalFilePath, reportContent);
782
781
  break;
783
782
  } catch (err) {
783
+ fs.appendFileSync(path.join(homedir, 'apipost-cli-error.log'), `${formattedTime}\t${String(err)}\n`);
784
+
784
785
  if (err.code === 'ENOENT') {
785
786
  fs.mkdirSync(options.outDir, { recursive: true });
786
787
  continue;
@@ -792,7 +793,6 @@ const downloadTestReport = async (data, options, request) => {
792
793
  continue;
793
794
  }
794
795
 
795
- fs.appendFileSync(path.join(homedir, 'apipost-cli-error.log'), `${formattedTime}\t${String(err)}\n`);
796
796
  throw err;
797
797
  }
798
798
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apipost-cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Apipost 命令行运行工具",
5
5
  "main": "bin/cli.js",
6
6
  "scripts": {
@@ -14,7 +14,7 @@
14
14
  "license": "UNLICENSED",
15
15
  "dependencies": {
16
16
  "apipost-inside-tools": "^0.1.54",
17
- "apipost-runtime": "^1.1.98",
17
+ "apipost-runtime": "^1.1.100",
18
18
  "cli-progress": "^3.12.0",
19
19
  "cli-table3": "^0.6.3",
20
20
  "colors": "^1.4.0",