瀏覽代碼

update travis build to include node tests. Minor refactor to grunt jobs for node

d98762625 6 年之前
父節點
當前提交
a1b116d2f5
共有 3 個文件被更改,包括 12 次插入6 次删除
  1. 3 0
      .travis.yml
  2. 8 6
      Gruntfile.js
  3. 1 0
      package.json

+ 3 - 0
.travis.yml

@@ -1,6 +1,8 @@
 language: node_js
 node_js:
   - node
+env:
+  - NODE_ENV=production
 cache: npm
 addons:
   chrome: stable
@@ -11,6 +13,7 @@ before_script:
 script:
   - grunt lint
   - grunt test
+  - grunt test-node
   - grunt docs
   - grunt node
   - grunt prod --msg="$COMPILE_MSG"

+ 8 - 6
Gruntfile.js

@@ -17,6 +17,8 @@ const UglifyJSWebpackPlugin = require("uglifyjs-webpack-plugin");
  * @license Apache-2.0
  */
 
+const NODE_PROD = process.env.NODE_ENV === "production";
+
 module.exports = function (grunt) {
     grunt.file.defaultEncoding = "utf8";
     grunt.file.preserveBOM = false;
@@ -271,7 +273,7 @@ module.exports = function (grunt) {
                 ]
             },
             node: {
-                mode: process.env.NODE_ENV === "prodction" ? "production" : "development",
+                mode: NODE_PROD ? "production" : "development",
                 target: "node",
                 entry: "./src/node/index.mjs",
                 externals: [NodeExternals({
@@ -290,7 +292,7 @@ module.exports = function (grunt) {
                     })
                 ],
                 optimization: {
-                    minimizer: [
+                    minimizer: NODE_PROD ? [
                         new UglifyJSWebpackPlugin({
                             cache: true,
                             parallel: true,
@@ -298,11 +300,11 @@ module.exports = function (grunt) {
                                 "keep_fnames": true,
                             }
                         })
-                    ]
+                    ] : []
                 }
             },
             nodeRepl: {
-                mode: process.env.NODE_ENV === "prodction" ? "production" : "development",
+                mode: NODE_PROD ? "production" : "development",
                 target: "node",
                 entry: "./src/node/repl-index.mjs",
                 externals: [NodeExternals({
@@ -321,7 +323,7 @@ module.exports = function (grunt) {
                     })
                 ],
                 optimization: {
-                    minimizer: [
+                    minimizer: NODE_PROD ? [
                         new UglifyJSWebpackPlugin({
                             parallel: true,
                             cache: true,
@@ -329,7 +331,7 @@ module.exports = function (grunt) {
                                 "keep_fnames": true,
                             }
                         })
-                    ]
+                    ] : []
                 }
             }
         },

+ 1 - 0
package.json

@@ -146,6 +146,7 @@
     "node-prod": "NODE_ENV=production grunt node",
     "repl": "grunt node && node build/node/CyberChef-repl.js",
     "test": "grunt test",
+    "test-node": "grunt test-node",
     "testui": "grunt testui",
     "docs": "grunt docs",
     "lint": "grunt lint",