Browse Source

use different babel config for tests using commonjs modules

mightyplow 6 years ago
parent
commit
3c803c6d91
1 changed files with 14 additions and 2 deletions
  1. 14 2
      package.json

+ 14 - 2
package.json

@@ -16,7 +16,7 @@
     "createPackageJson": "node bin/createPackageJson.js",
     "doc": "jsdoc2md -f src/**/*.js > dist/README.md",
     "nodeunit": "nodeunit",
-    "test": "babel-node node_modules/.bin/nodeunit src/**/__tests__/*.test.js",
+    "test": "BABEL_ENV=test babel-node node_modules/.bin/nodeunit src/**/__tests__/*.test.js",
     "build": "rimraf dist && babel src -d dist --ignore __tests__",
     "watch": "npm run build -- --watch",
     "postbuild": "npm run doc",
@@ -44,7 +44,19 @@
         }
       ],
       "stage-2"
-    ]
+    ],
+    "env": {
+      "test": {
+        "presets": [
+          [
+            "env",
+            {
+              "modules": "commonjs"
+            }
+          ]
+        ]
+      }
+    }
   },
   "dependencies": {
     "core-js": "^2.5.1"