Repository: babel/minify
Pull request #715 (2017-11-07 21:03:42)

Move test utils to packages
+ Part 1 of a bigger change - moving test suite to auto generated
snapshots.
+ This is to help switch to babel-7 as almost all tests fail because of
the code styling of the generated output.

TODO:
+ [x] Fix for Node 4.


Patch:
diff --git a/.travis.yml b/.travis.yml
index fb6dd87..4ceda80 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -11,11 +11,11 @@ node_js:
 - '4'
 
 before_install:
-- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.0.2
+- curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.3.2
 - export PATH=$HOME/.yarn/bin:$PATH
 
 before_script:
-- yarn run bootstrap && yarn run build
+- yarn build
 
 script:
 - if [ -n "${LINT-}" ]; then yarn run lint ; fi
diff --git a/appveyor.yml b/appveyor.yml
index fb81702..cebb9a0 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -12,7 +12,7 @@ cache:
 
 install:
   - ps: Install-Product node $env:nodejs_version x64
-  - npm install -g yarn@1.0.2
+  - npm install -g yarn@1.3.2
   - set PATH=%APPDATA%\npm;%PATH%
   - yarn
 
diff --git a/circle.yml b/circle.yml
index 22259ab..aeb77bc 100644
--- a/circle.yml
+++ b/circle.yml
@@ -4,7 +4,7 @@ machine:
   node:
     version: "node"
   environment:
-    PATH: $PATH:./node_modules/.bin
+    PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin:./node_modules/.bin"
 
 checkout:
   post:
@@ -14,8 +14,10 @@ checkout:
 dependencies:
   override:
     - yarn
+  cache_directories:
+    - ~/.cache/yarn
   post:
-    - yarn run bootstrap && yarn run build
+    - yarn build
 
 test:
   override:
diff --git a/gulpfile.babel.js b/gulpfile.babel.js
index 6b6fa43..fb7d19e 100644
--- a/gulpfile.babel.js
+++ b/gulpfile.babel.js
@@ -6,26 +6,33 @@ const gutil = require("gulp-util");
 const gulp = require("gulp");
 const path = require("path");
 
-const scripts = "./packages/*/src/**/*.js";
-const dest = "packages";
+export const build = gulp.series(buildPackages, buildUtils);
 
-let srcEx, libFragment;
+export const watch = gulp.series(build, () => {
+  const scripts = [
+    getBuildConfig("packages").scripts,
+    getBuildConfig("utils").scripts
+  ];
+  gulp.watch(scripts, { debounceDelay: 200 }, build).on("error", () => {});
+});
 
-if (path.win32 === path) {
-  srcEx = /(packages\\[^\\]+)\\src\\/;
-  libFragment = "$1\\lib\\";
-} else {
-  srcEx = new RegExp("(packages/[^/]+)/src/");
-  libFragment = "$1/lib/";
+export function buildPackages() {
+  return getBuildTask(getBuildConfig("packages"));
 }
 
-export function build() {
+export function buildUtils() {
+  return getBuildTask(getBuildConfig("utils"));
+}
+
+export default build;
+
+function getBuildTask({ scripts, dest }) {
   return gulp
     .src(scripts)
     .pipe(
       through.obj((file, enc, callback) => {
         file._path = file.path;
-        file.path = file.path.replace(srcEx, libFragment);
+        file.path = path.resolve(file.base, swapSrcWithLib(file.relative));
         callback(null, file);
       })
     )
@@ -40,8 +47,15 @@ export function build() {
     .pipe(gulp.dest(dest));
 }
 
-export const watch = gulp.series(build, () => {
-  gulp.watch(scripts, { debounceDelay: 200 }, build).on("error", () => {});
-});
+function getBuildConfig(dir) {
+  const scripts = `./${dir}/*/src/**/*.js`;
+  const dest = dir;
 
-export default build;
+  return { scripts, dest };
+}
+
+function swapSrcWithLib(srcPath) {
+  const parts = srcPath.split(path.sep);
+  parts[1] = "lib";
+  return parts.join(path.sep);
+}
diff --git a/package.json b/package.json
index 42e131d..82042c9 100644
--- a/package.json
+++ b/package.json
@@ -6,13 +6,13 @@
     "build": "gulp build",
     "changelog": "lerna-changelog",
     "clean": "lerna clean",
-    "coverage": "jest --coverage --maxWorkers=4",
+    "coverage": "jest --coverage --maxWorkers=4 --no-cache",
     "coverage-ci": "codecov -f coverage/coverage-final.json",
     "fix": "eslint --fix .",
     "lint": "eslint .",
     "publish": "git pull origin master --rebase && npm run build && npm test && lerna publish",
     "publish-internal": "git pull origin master --rebase && npm run build && NPM_DIST_TAG=internal ./node_modules/.bin/lerna publish --skip-git",
-    "test": "jest --maxWorkers=4",
+    "test": "jest --maxWorkers=4 --no-cache",
     "test-ci": "npm run bootstrap && npm run build && npm run coverage",
     "updated": "lerna updated",
     "watch": "gulp watch"
@@ -61,11 +61,13 @@
       "/fixtures/"
     ],
     "roots": [
-      "packages"
+      "packages",
+      "utils"
     ],
     "coverageDirectory": "./coverage/"
   },
   "workspaces": [
-    "packages/*"
+    "packages/*",
+    "utils/*"
   ]
 }
diff --git a/utils/unpad/package.json b/utils/unpad/package.json
new file mode 100644
index 0000000..cbecfb8
--- /dev/null
+++ b/utils/unpad/package.json
@@ -0,0 +1,6 @@
+{
+  "name": "unpad",
+  "version": "0.0.0",
+  "private": true,
+  "main": "lib/unpad.js"
+}


Test patch:
diff --git a/packages/babel-plugin-minify-builtins/__tests__/minify-builtins.js b/packages/babel-plugin-minify-builtins/__tests__/minify-builtins.js
index 7837a6e..706450f 100644
--- a/packages/babel-plugin-minify-builtins/__tests__/minify-builtins.js
+++ b/packages/babel-plugin-minify-builtins/__tests__/minify-builtins.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform").snapshot(
-  require("../src/index")
-);
+const thePlugin = require("test-transform").snapshot(require("../src/index"));
 
 describe("minify-builtins", () => {
   thePlugin(
diff --git a/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js b/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js
index 408738f..58c9d9e 100644
--- a/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js
+++ b/packages/babel-plugin-minify-constant-folding/__tests__/constant-folding-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("constant-folding-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-minify-dead-code-elimination/__tests__/dead-code-elimination-test.js b/packages/babel-plugin-minify-dead-code-elimination/__tests__/dead-code-elimination-test.js
index 4c622c3..19b2a63 100644
--- a/packages/babel-plugin-minify-dead-code-elimination/__tests__/dead-code-elimination-test.js
+++ b/packages/babel-plugin-minify-dead-code-elimination/__tests__/dead-code-elimination-test.js
@@ -1,10 +1,10 @@
 jest.autoMockOff();
 
 const babel = require("babel-core");
-const unpad = require("../../../utils/unpad");
+const unpad = require("unpad");
 const deadcode = require("../src/index");
 const simplify = require("../../babel-plugin-minify-simplify/src/index");
-const thePlugin = require("../../../utils/test-transform")(deadcode);
+const thePlugin = require("test-transform")(deadcode);
 
 function transformWithSimplify(code) {
   return babel.transform(code, {
diff --git a/packages/babel-plugin-minify-flip-comparisons/__tests__/flip-comparisons-test.js b/packages/babel-plugin-minify-flip-comparisons/__tests__/flip-comparisons-test.js
index 4483df7..b35aa46 100644
--- a/packages/babel-plugin-minify-flip-comparisons/__tests__/flip-comparisons-test.js
+++ b/packages/babel-plugin-minify-flip-comparisons/__tests__/flip-comparisons-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("flip-comparisons", () => {
   thePlugin(
diff --git a/packages/babel-plugin-minify-guarded-expressions/__tests__/guarded-expressions-test.js b/packages/babel-plugin-minify-guarded-expressions/__tests__/guarded-expressions-test.js
index 92b4a14..ddd0d28 100644
--- a/packages/babel-plugin-minify-guarded-expressions/__tests__/guarded-expressions-test.js
+++ b/packages/babel-plugin-minify-guarded-expressions/__tests__/guarded-expressions-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("guarded-expressions-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-minify-infinity/__tests__/infinity-test.js b/packages/babel-plugin-minify-infinity/__tests__/infinity-test.js
index bb99574..d1c4a38 100644
--- a/packages/babel-plugin-minify-infinity/__tests__/infinity-test.js
+++ b/packages/babel-plugin-minify-infinity/__tests__/infinity-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("minify-infinity", () => {
   thePlugin(
diff --git a/packages/babel-plugin-minify-mangle-names/__tests__/mangle-names-test.js b/packages/babel-plugin-minify-mangle-names/__tests__/mangle-names-test.js
index c84e74e..cf00968 100644
--- a/packages/babel-plugin-minify-mangle-names/__tests__/mangle-names-test.js
+++ b/packages/babel-plugin-minify-mangle-names/__tests__/mangle-names-test.js
@@ -1,7 +1,7 @@
 jest.autoMockOff();
 
 const mangler = require("../src/index");
-const thePlugin = require("../../../utils/test-transform")(mangler);
+const thePlugin = require("test-transform")(mangler);
 
 describe("mangle-names", () => {
   thePlugin(
diff --git a/packages/babel-plugin-minify-mangle-names/__tests__/mangler-block-scoping.js b/packages/babel-plugin-minify-mangle-names/__tests__/mangler-block-scoping.js
index cdb4939..83c67a9 100644
--- a/packages/babel-plugin-minify-mangle-names/__tests__/mangler-block-scoping.js
+++ b/packages/babel-plugin-minify-mangle-names/__tests__/mangler-block-scoping.js
@@ -1,7 +1,7 @@
 jest.autoMockOff();
 
 const babel = require("babel-core");
-const unpad = require("../../../utils/unpad");
+const unpad = require("unpad");
 const traverse = require("babel-traverse").default;
 
 describe("mangler with block-scoping", () => {
diff --git a/packages/babel-plugin-minify-numeric-literals/__tests__/numeric-literals-test.js b/packages/babel-plugin-minify-numeric-literals/__tests__/numeric-literals-test.js
index 383194f..630c544 100644
--- a/packages/babel-plugin-minify-numeric-literals/__tests__/numeric-literals-test.js
+++ b/packages/babel-plugin-minify-numeric-literals/__tests__/numeric-literals-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("numeric-literals", () => {
   thePlugin(
diff --git a/packages/babel-plugin-minify-simplify/__tests__/simplify-test.js b/packages/babel-plugin-minify-simplify/__tests__/simplify-test.js
index ef29adf..4f1ee36 100644
--- a/packages/babel-plugin-minify-simplify/__tests__/simplify-test.js
+++ b/packages/babel-plugin-minify-simplify/__tests__/simplify-test.js
@@ -35,7 +35,7 @@ jest.autoMockOff();
 const comparisonPlugin = require("../../babel-plugin-transform-simplify-comparison-operators/src");
 const plugin = require("../src/index");
 
-const thePlugin = require("../../../utils/test-transform")(plugin);
+const thePlugin = require("test-transform")(plugin);
 
 describe("simplify-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-minify-type-constructors/__tests__/type-constructors-test.js b/packages/babel-plugin-minify-type-constructors/__tests__/type-constructors-test.js
index be00d7f..ddbfffc 100644
--- a/packages/babel-plugin-minify-type-constructors/__tests__/type-constructors-test.js
+++ b/packages/babel-plugin-minify-type-constructors/__tests__/type-constructors-test.js
@@ -2,8 +2,8 @@ jest.autoMockOff();
 
 const babel = require("babel-core");
 const plugin = require("../src/index");
-const unpad = require("../../../utils/unpad");
-const thePlugin = require("../../../utils/test-transform")(plugin);
+const unpad = require("unpad");
+const thePlugin = require("test-transform")(plugin);
 
 describe("type-constructors-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-transform-inline-consecutive-adds/__tests__/transform-inline-consecutive-adds-test.js b/packages/babel-plugin-transform-inline-consecutive-adds/__tests__/transform-inline-consecutive-adds-test.js
index f55baa3..d8d8b2c 100644
--- a/packages/babel-plugin-transform-inline-consecutive-adds/__tests__/transform-inline-consecutive-adds-test.js
+++ b/packages/babel-plugin-transform-inline-consecutive-adds/__tests__/transform-inline-consecutive-adds-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("transform-inline-consecutive-adds-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-transform-inline-environment-variables/__tests__/inline-env-var-test.js b/packages/babel-plugin-transform-inline-environment-variables/__tests__/inline-env-var-test.js
index dfa216b..b649c33 100644
--- a/packages/babel-plugin-transform-inline-environment-variables/__tests__/inline-env-var-test.js
+++ b/packages/babel-plugin-transform-inline-environment-variables/__tests__/inline-env-var-test.js
@@ -1,7 +1,7 @@
 jest.autoMockOff();
 
 const plugin = require("../src/index");
-const thePlugin = require("../../../utils/test-transform")(plugin);
+const thePlugin = require("test-transform")(plugin);
 
 describe("inline-env-plugin", () => {
   let prev;
diff --git a/packages/babel-plugin-transform-member-expression-literals/__tests__/transform-member-expression-literals-test.js b/packages/babel-plugin-transform-member-expression-literals/__tests__/transform-member-expression-literals-test.js
index 1e09217..7fc20ec 100644
--- a/packages/babel-plugin-transform-member-expression-literals/__tests__/transform-member-expression-literals-test.js
+++ b/packages/babel-plugin-transform-member-expression-literals/__tests__/transform-member-expression-literals-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("transform-member-expressions-literals-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-transform-merge-sibling-variables/__tests__/transform-merge-sibling-variables-test.js b/packages/babel-plugin-transform-merge-sibling-variables/__tests__/transform-merge-sibling-variables-test.js
index 8b474d1..2005c32 100644
--- a/packages/babel-plugin-transform-merge-sibling-variables/__tests__/transform-merge-sibling-variables-test.js
+++ b/packages/babel-plugin-transform-merge-sibling-variables/__tests__/transform-merge-sibling-variables-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("transform-merge-sibling-variables-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-transform-minify-booleans/__tests__/booleans-test.js b/packages/babel-plugin-transform-minify-booleans/__tests__/booleans-test.js
index a998b94..ded332e 100644
--- a/packages/babel-plugin-transform-minify-booleans/__tests__/booleans-test.js
+++ b/packages/babel-plugin-transform-minify-booleans/__tests__/booleans-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("boolean-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-transform-node-env-inline/__tests__/node-env-inline-test.js b/packages/babel-plugin-transform-node-env-inline/__tests__/node-env-inline-test.js
index f463fcb..1857220 100644
--- a/packages/babel-plugin-transform-node-env-inline/__tests__/node-env-inline-test.js
+++ b/packages/babel-plugin-transform-node-env-inline/__tests__/node-env-inline-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("node-env-inline-plugin", () => {
   let prev;
diff --git a/packages/babel-plugin-transform-property-literals/__tests__/transform-property-literals-test.js b/packages/babel-plugin-transform-property-literals/__tests__/transform-property-literals-test.js
index db37b72..fb6ada0 100644
--- a/packages/babel-plugin-transform-property-literals/__tests__/transform-property-literals-test.js
+++ b/packages/babel-plugin-transform-property-literals/__tests__/transform-property-literals-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("transform-property-literals-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-transform-regexp-constructors/__tests__/transform-regexp-constructors-test.js b/packages/babel-plugin-transform-regexp-constructors/__tests__/transform-regexp-constructors-test.js
index c46ff75..a059a06 100644
--- a/packages/babel-plugin-transform-regexp-constructors/__tests__/transform-regexp-constructors-test.js
+++ b/packages/babel-plugin-transform-regexp-constructors/__tests__/transform-regexp-constructors-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("transform-regexp-constructors-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js b/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js
index b3e237e..b7d999c 100644
--- a/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js
+++ b/packages/babel-plugin-transform-remove-console/__tests__/remove-console-test.js
@@ -1,7 +1,7 @@
 jest.autoMockOff();
 
 const plugin = require("../src/index");
-const thePlugin = require("../../../utils/test-transform")(plugin);
+const thePlugin = require("test-transform")(plugin);
 
 describe("remove-console-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-transform-remove-debugger/__tests__/remove-debugger-test.js b/packages/babel-plugin-transform-remove-debugger/__tests__/remove-debugger-test.js
index 135b1fe..444fc3d 100644
--- a/packages/babel-plugin-transform-remove-debugger/__tests__/remove-debugger-test.js
+++ b/packages/babel-plugin-transform-remove-debugger/__tests__/remove-debugger-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("remove-debugger-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-transform-remove-undefined/__tests__/babel-plugin-transform-remove-undefined-test.js b/packages/babel-plugin-transform-remove-undefined/__tests__/babel-plugin-transform-remove-undefined-test.js
index 671c46a..e0de6a7 100644
--- a/packages/babel-plugin-transform-remove-undefined/__tests__/babel-plugin-transform-remove-undefined-test.js
+++ b/packages/babel-plugin-transform-remove-undefined/__tests__/babel-plugin-transform-remove-undefined-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("transform-remove-undefined-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-transform-simplify-comparison-operators/__tests__/strict-equals-test.js b/packages/babel-plugin-transform-simplify-comparison-operators/__tests__/strict-equals-test.js
index 3e91533..4235cb1 100644
--- a/packages/babel-plugin-transform-simplify-comparison-operators/__tests__/strict-equals-test.js
+++ b/packages/babel-plugin-transform-simplify-comparison-operators/__tests__/strict-equals-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("simplify-comparison-operators-plugin", () => {
   thePlugin(
diff --git a/packages/babel-plugin-transform-undefined-to-void/__tests__/undefined-test.js b/packages/babel-plugin-transform-undefined-to-void/__tests__/undefined-test.js
index 2791c15..bf76a51 100644
--- a/packages/babel-plugin-transform-undefined-to-void/__tests__/undefined-test.js
+++ b/packages/babel-plugin-transform-undefined-to-void/__tests__/undefined-test.js
@@ -1,8 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(
-  require("../src/index")
-);
+const thePlugin = require("test-transform")(require("../src/index"));
 
 describe("undefined-plugin", () => {
   thePlugin(
diff --git a/packages/babel-preset-minify/__tests__/babili-es2015-tests.js b/packages/babel-preset-minify/__tests__/babili-es2015-tests.js
index 49cc15e..9ead77a 100644
--- a/packages/babel-preset-minify/__tests__/babili-es2015-tests.js
+++ b/packages/babel-preset-minify/__tests__/babili-es2015-tests.js
@@ -3,7 +3,7 @@ jest.autoMockOff();
 const es2015 = require("babel-preset-es2015");
 const minifyPreset = require("../src/index");
 
-const thePlugin = require("../../../utils/test-transform")(null, {
+const thePlugin = require("test-transform")(null, {
   plugins: [],
   minified: false,
   presets: [minifyPreset, es2015]
diff --git a/packages/babel-preset-minify/__tests__/preset-tests.js b/packages/babel-preset-minify/__tests__/preset-tests.js
index e704e80..4f7bf2c 100644
--- a/packages/babel-preset-minify/__tests__/preset-tests.js
+++ b/packages/babel-preset-minify/__tests__/preset-tests.js
@@ -1,6 +1,6 @@
 jest.autoMockOff();
 
-const thePlugin = require("../../../utils/test-transform")(null, {
+const thePlugin = require("test-transform")(null, {
   plugins: [],
   minified: false,
   presets: [require("../src/index")]
diff --git a/packages/gulp-babel-minify/__tests__/gulp-babili-test.js b/packages/gulp-babel-minify/__tests__/gulp-babili-test.js
index 4f0ca11..53fb775 100644
--- a/packages/gulp-babel-minify/__tests__/gulp-babili-test.js
+++ b/packages/gulp-babel-minify/__tests__/gulp-babili-test.js
@@ -4,7 +4,7 @@ const gutil = require("gulp-util");
 const babelCore = require("babel-core");
 const minifyPreset = require("babel-preset-minify");
 
-const unpad = require("../../../utils/unpad");
+const unpad = require("unpad");
 const gulpBabelMinify = require("../src/index");
 
 describe("gulp-babel-minify", () => {
diff --git a/utils/test-transform/package.json b/utils/test-transform/package.json
new file mode 100644
index 0000000..f0a18c8
--- /dev/null
+++ b/utils/test-transform/package.json
@@ -0,0 +1,6 @@
+{
+  "name": "test-transform",
+  "version": "0.0.0",
+  "private": true,
+  "main": "lib/test-transform.js"
+}
diff --git a/utils/test-transform.js b/utils/test-transform/src/test-transform.js
similarity index 98%
rename from utils/test-transform.js
rename to utils/test-transform/src/test-transform.js
index 318706b..e7ab0d2 100644
--- a/utils/test-transform.js
+++ b/utils/test-transform/src/test-transform.js
@@ -1,6 +1,6 @@
 const babel = require("babel-core");
 
-const unpad = require("./unpad");
+const unpad = require("unpad");
 
 function _transform(source, options) {
   return babel.transform(unpad(source), options).code.trim();