Explorar el Código

单元测试相关

MaiXinRong hace 6 años
padre
commit
49c4526dcd
Se han modificado 2 ficheros con 60 adiciones y 1 borrados
  1. 58 0
      config/config.autotest.js
  2. 2 1
      package.json

+ 58 - 0
config/config.autotest.js

@@ -0,0 +1,58 @@
+'use strict';
+/**
+ * 开发环境相关配置
+ *
+ * @author CaiAoLin
+ * @date 2017/8/29
+ * @version
+ */
+
+module.exports = appInfo => {
+    const config = {};
+    // 数据库配置
+    config.mysql = {
+        client: {
+            // host
+            host: '192.168.1.70',
+            // 端口号
+            port: '3306',
+            // 用户名
+            user: 'root',
+            // 密码
+            password: 'root',
+            // 数据库名
+            database: 'calc_test',
+        },
+        // 是否加载到 app 上,默认开启
+        app: true,
+        // 是否加载到 agent 上,默认关闭
+        agent: false,
+    };
+
+    // redis设置
+    config.redis = {
+        client: {
+            host: '192.168.1.70',
+            port: '6379',
+            password: 'test',
+            db: '0',
+        },
+        agent: true,
+        version: '1.0.0',
+    };
+
+    // 前端验证
+    config.jsValidator = {
+        client: {},
+        app: true,
+    };
+    // 是否压缩替换前端js
+    config.min = false;
+
+    config.logger = {
+        consoleLevel: 'WARN',
+        disableConsoleAfterReady: false,
+    };
+
+    return config;
+};

+ 2 - 1
package.json

@@ -54,9 +54,10 @@
     "dev-qa": "set EGG_SERVER_ENV=qa&&egg-bin dev --port 7002",
     "dev-test": "set EGG_SERVER_ENV=test&&egg-bin dev --port 7002",
     "test": "npm run lint -- --fix&&npm run test-local",
+    "test-sim": "egg-bin test",
     "test-local": "set EGG_SERVER_ENV=local&& egg-bin test",
     "test-qa": "set EGG_SERVER_ENV=qa&&egg-bin test",
-    "test-auto": "set EGG_SERVER_ENV=test&&egg-bin test",
+    "test-auto": "set EGG_SERVER_ENV=autotest&&egg-bin test",
     "cov": "egg-bin cov",
     "lint": "eslint .",
     "ci": "npm run lint && npm run cov",