Repository: TheBrainFamily/cypress-cucumber-preprocessor
Pull request #320 (2020-02-10 08:05:49)

chore(deps): [security] bump handlebars from 4.0.11 to 4.7.3
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.0.11 to 4.7.3. **This update includes a security fix.**
<details>
<summary>Vulnerabilities fixed</summary>
<p><em>Sourced from <a href="https://github.com/advisories/GHSA-w457-6q6x-cgp9">The GitHub Security Advisory Database</a>.</em></p>
<blockquote>
<p><strong>High severity vulnerability that affects handlebars</strong>
Versions of handlebars prior to 4.3.0 are vulnerable to Prototype Pollution leading to Remote Code Execution. Templates may alter an Object's <strong>proto</strong> and <strong>defineGetter</strong> properties, which may allow an attacker to execute arbitrary code through crafted payloads.</p>
<p>Affected versions: &lt; 4.3.0</p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a href="https://github.com/wycats/handlebars.js/blob/master/release-notes.md">handlebars's changelog</a>.</em></p>
<blockquote>
<h2>v4.7.3 - February 5th, 2020</h2>
<p>Chore/Housekeeping:</p>
<ul>
<li><a href="https://github-redirect.dependabot.com/wycats/handlebars.js/issues/1644">#1644</a> - Download links to aws broken on handlebarsjs.com - access denied (<a href="https://api.github.com/users/Tea56">@Tea56</a>)</li>
<li>Fix spelling and punctuation in changelog - d78cc73</li>
</ul>
<p>Bugfixes:</p>
<ul>
<li>Add Type Definition for Handlebars.VERSION, Fixes <a href="https://github-redirect.dependabot.com/wycats/handlebars.js/issues/1647">#1647</a> - 4de51fe</li>
<li>Include Type Definition for runtime.js in Package - a32d05f</li>
</ul>
<p>Compatibility notes:</p>
<ul>
<li>No incompatibilities are to be expected</li>
</ul>
<p><a href="https://github.com/wycats/handlebars.js/compare/v4.7.2...v4.7.3">Commits</a></p>
<h2>v4.7.2 - January 13th, 2020</h2>
<p>Bugfixes:</p>
<ul>
<li>fix: don't wrap helpers that are not functions - 9d5aa36, <a href="https://github-redirect.dependabot.com/wycats/handlebars.js/issues/1639">#1639</a></li>
</ul>
<p>Chore/Build:</p>
<ul>
<li>chore: execute saucelabs-task only if access-key exists - a4fd391</li>
</ul>
<p>Compatibility notes:</p>
<ul>
<li>No breaking changes are to be expected</li>
</ul>
<p><a href="https://github.com/wycats/handlebars.js/compare/v4.7.1...v4.7.2">Commits</a></p>
<h2>v4.7.1 - January 12th, 2020</h2>
<p>Bugfixes:</p>
<ul>
<li>fix: fix log output in case of illegal property access - f152dfc</li>
<li>fix: log error for illegal property access only once per property - 3c1e252</li>
</ul>
<p>Compatibility notes:</p>
<ul>
<li>no incompatibilities are to be expected.</li>
</ul>
<p><a href="https://github.com/wycats/handlebars.js/compare/v4.7.0...v4.7.1">Commits</a></p>
<h2>v4.7.0 - January 10th, 2020</h2>
<p>Features:</p>
</tr></table> ... (truncated)
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/wycats/handlebars.js/commit/c9789691af60b446f12f75dd9762f9d8fd3f36eb"><code>c978969</code></a> v4.7.3</li>
<li><a href="https://github.com/wycats/handlebars.js/commit/9278f217e0033cc980c58d50e7fd4b05c8ef7c35"><code>9278f21</code></a> Update release notes</li>
<li><a href="https://github.com/wycats/handlebars.js/commit/d78cc73d3c51763654d66d52b5b761231f5adea9"><code>d78cc73</code></a> Fixes spelling and punctuation</li>
<li><a href="https://github.com/wycats/handlebars.js/commit/4de51fe26ba049c743993424b937c0afc6cd9ae9"><code>4de51fe</code></a> Add Type Definition for Handlebars.VERSION, Fixes <a href="https://github-redirect.dependabot.com/wycats/handlebars.js/issues/1647">#1647</a></li>
<li><a href="https://github.com/wycats/handlebars.js/commit/a32d05f2fc65b1c017e7f482430392d242a97ffc"><code>a32d05f</code></a> Include Type Definition for runtime.js in Package</li>
<li><a href="https://github.com/wycats/handlebars.js/commit/ad63f5189ffe262e013f2bb9da69c66bed7801ee"><code>ad63f51</code></a> chore: add missing &quot;await&quot; in aws-s3 publishing code</li>
<li><a href="https://github.com/wycats/handlebars.js/commit/586e672c8bba7db787bc9bfe9a9fde4ec98d5b4f"><code>586e672</code></a> v4.7.2</li>
<li><a href="https://github.com/wycats/handlebars.js/commit/f0c6c4cc1f9a91371535ad6affe09dfc1880dd9e"><code>f0c6c4c</code></a> Update release notes</li>
<li><a href="https://github.com/wycats/handlebars.js/commit/a4fd391ba1c9faa1004e879f314beb80c3afe0b6"><code>a4fd391</code></a> chore: execute saucelabs-task only if access-key exists</li>
<li><a href="https://github.com/wycats/handlebars.js/commit/9d5aa363cf3031b586e9945cf990e178f5b370db"><code>9d5aa36</code></a> fix: don't wrap helpers that are not functions</li>
<li>Additional commits viewable in <a href="https://github.com/wycats/handlebars.js/compare/v4.0.11...v4.7.3">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://api.dependabot.com/badges/compatibility_score?dependency-name=handlebars&package-manager=npm_and_yarn&previous-version=4.0.11&new-version=4.7.3)](https://dependabot.com/compatibility-score/?dependency-name=handlebars&package-manager=npm_and_yarn&previous-version=4.0.11&new-version=4.7.3)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)



</details>


Patch:
diff --git a/README.md b/README.md
index 7ac0c15..e8e538f 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,7 @@ You can follow the documentation below, or if you prefer to hack on a working ex
   * [Smart tagging](#smart-tagging)
 * [How to run the tests](#excluding-tests)
   * [Running tagged tests](#running-tagged-tests)
+  * [Ignoring specific scenarios using tags when executing test runner](#ignoring-specific-scenarios-using-tags-when-executing-test-runner)
   * [Output](#output)
 * [IDE support](#ide-support)
   * [Webstorm](#webstorm)
@@ -329,6 +330,25 @@ Example:
 Please note - we use our own cypress-tags wrapper to speed things up.
 For more details and examples please take a look to the [example repo](https://github.com/TheBrainFamily/cypress-cucumber-example).
 
+### Ignoring specific scenarios using tags when executing test runner
+You can also use tags to skip or ignore specific tests/scenarios when running cypress test runner (where you don't have the abilitiy to pass parameters like in the examples above for the execution)
+
+The trick consists in adding the "env" property with the "TAGS" subproperty in the cypress.json configuration file. It would look something like this:
+
+```javascript
+{
+    "env": {
+        "TAGS": "not @ignore"
+    },
+    //rest of configuration options
+    "baseUrl": "yourBaseUrl",       
+    "ignoreTestFiles": "*.js",
+    //etc
+}
+```
+
+Then, any scenarios tagged with @ignore will be skipped when running the tests using the cypress test runner
+
 ### Limiting to a subset of feature files
 You can use a glob expression to select which feature files should be included.
 
diff --git a/cypress-tags.js b/cypress-tags.js
index 60445f0..b882171 100755
--- a/cypress-tags.js
+++ b/cypress-tags.js
@@ -31,13 +31,18 @@ const featuresToRun = [];
 
 const found = process.argv.slice(2).find(arg => arg.indexOf("TAGS=") === 0);
 
-const envTags = found.replace(/.*=/, "");
+const envTags = found ? found.replace(/.*=/, "") : "";
 debug("Found tag expression", envTags);
 
 paths.forEach(featurePath => {
   const spec = `${fs.readFileSync(featurePath)}`;
   const parsedFeature = new Parser().parse(spec);
 
+  if (!parsedFeature.feature) {
+    debug(`Feature: ${featurePath} is empty`);
+    return;
+  }
+
   const featureTags = parsedFeature.feature.tags;
   const featureShouldRun = shouldProceedCurrentStep(featureTags, envTags);
   const taggedScenarioShouldRun = parsedFeature.feature.children.some(
@@ -58,7 +63,7 @@ try {
   if (featuresToRun.length || envTags === "") {
     execFileSync(
       process.platform === "win32"
-        ? `${__dirname}/../.bin/cypress.cmd`
+        ? `cypress.cmd`
         : `${__dirname}/../.bin/cypress`,
       [...process.argv.slice(2), "--spec", featuresToRun.join(",")],
       {
diff --git a/lib/index.js b/lib/index.js
index 76ffb4e..0e55ada 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -37,24 +37,51 @@ const touch = filename => {
 
 let watcher;
 
-const preprocessor = (options = browserify.defaultOptions) => async file => {
-  if (options.browserifyOptions.transform.indexOf(transform) === -1) {
-    options.browserifyOptions.transform.unshift(transform);
+// Include our transform in Browserify options
+const wrapOptions = options => {
+  let wrappedTransform;
+  if (
+    !options.browserifyOptions ||
+    !Array.isArray(options.browserifyOptions.transform)
+  ) {
+    wrappedTransform = [transform];
+  } else if (!options.browserifyOptions.transform.includes(transform)) {
+    wrappedTransform = [transform, ...options.browserifyOptions.transform];
+  } else {
+    wrappedTransform = options.browserifyOptions.transform;
   }
 
-  if (file.shouldWatch) {
-    if (watcher) {
-      watcher.close();
+  return {
+    ...options,
+    browserifyOptions: {
+      ...(options.browserifyOptions || {}),
+      transform: wrappedTransform
     }
-    watcher = chokidar
-      .watch([`${stepDefinitionPath()}*.js`, `${stepDefinitionPath()}*.ts`], {
-        ignoreInitial: true
-      })
-      .on("all", () => {
-        touch(file.filePath);
-      });
+  };
+};
+
+const preprocessor = (options = browserify.defaultOptions) => {
+  if (typeof options !== "object") {
+    throw new Error("Preprocessor options must be an object");
   }
-  return browserify(options)(file);
+
+  const wrappedOptions = wrapOptions(options);
+
+  return async file => {
+    if (file.shouldWatch) {
+      if (watcher) {
+        watcher.close();
+      }
+      watcher = chokidar
+        .watch([`${stepDefinitionPath()}*.js`, `${stepDefinitionPath()}*.ts`], {
+          ignoreInitial: true
+        })
+        .on("all", () => {
+          touch(file.filePath);
+        });
+    }
+    return browserify(wrappedOptions)(file);
+  };
 };
 
 module.exports = {
diff --git a/package-lock.json b/package-lock.json
index 24892de..d1f1642 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -3144,24 +3144,6 @@
       "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=",
       "dev": true
     },
-    "align-text": {
-      "version": "0.1.4",
-      "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz",
-      "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=",
-      "dev": true,
-      "optional": true,
-      "requires": {
-        "kind-of": "^3.0.2",
-        "longest": "^1.0.1",
-        "repeat-string": "^1.5.2"
-      }
-    },
-    "amdefine": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
-      "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
-      "dev": true
-    },
     "ansi-escapes": {
       "version": "1.4.0",
       "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz",
@@ -4019,13 +4001,6 @@
       "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=",
       "dev": true
     },
-    "camelcase": {
-      "version": "1.2.1",
-      "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz",
-      "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=",
-      "dev": true,
-      "optional": true
-    },
     "camelcase-keys": {
       "version": "4.2.0",
       "resolved": "https://registry.npmjs.org/camelcase-keys/-/camelcase-keys-4.2.0.tgz",
@@ -4075,17 +4050,6 @@
       "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
       "dev": true
     },
-    "center-align": {
-      "version": "0.1.3",
-      "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz",
-      "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=",
-      "dev": true,
-      "optional": true,
-      "requires": {
-        "align-text": "^0.1.3",
-        "lazy-cache": "^1.0.3"
-      }
-    },
     "chai": {
       "version": "4.1.2",
       "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz",
@@ -4547,27 +4511,6 @@
       "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=",
       "dev": true
     },
-    "cliui": {
-      "version": "2.1.0",
-      "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz",
-      "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=",
-      "dev": true,
-      "optional": true,
-      "requires": {
-        "center-align": "^0.1.1",
-        "right-align": "^0.1.1",
-        "wordwrap": "0.0.2"
-      },
-      "dependencies": {
-        "wordwrap": {
-          "version": "0.0.2",
-          "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz",
-          "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=",
-          "dev": true,
-          "optional": true
-        }
-      }
-    },
     "co": {
       "version": "4.6.0",
       "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz",
@@ -8288,30 +8231,39 @@
       "dev": true
     },
     "handlebars": {
-      "version": "4.0.11",
-      "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.0.11.tgz",
-      "integrity": "sha1-Ywo13+ApS8KB7a5v/F0yn8eYLcw=",
+      "version": "4.7.3",
+      "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.3.tgz",
+      "integrity": "sha512-SRGwSYuNfx8DwHD/6InAPzD6RgeruWLT+B8e8a7gGs8FWgHzlExpTFMEq2IA6QpAfOClpKHy6+8IqTjeBCu6Kg==",
       "dev": true,
       "requires": {
-        "async": "^1.4.0",
+        "neo-async": "^2.6.0",
         "optimist": "^0.6.1",
-        "source-map": "^0.4.4",
-        "uglify-js": "^2.6"
+        "source-map": "^0.6.1",
+        "uglify-js": "^3.1.4"
       },
       "dependencies": {
-        "async": {
-          "version": "1.5.2",
-          "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz",
-          "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=",
-          "dev": true
+        "commander": {
+          "version": "2.20.3",
+          "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
+          "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
+          "dev": true,
+          "optional": true
         },
         "source-map": {
-          "version": "0.4.4",
-          "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz",
-          "integrity": "sha1-66T12pwNyZneaAMti092FzZSA2s=",
+          "version": "0.6.1",
+          "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+          "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+          "dev": true
+        },
+        "uglify-js": {
+          "version": "3.7.7",
+          "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.7.7.tgz",
+          "integrity": "sha512-FeSU+hi7ULYy6mn8PKio/tXsdSXN35lm4KgV2asx00kzrLU9Pi3oAslcJT70Jdj7PHX29gGUPOT6+lXGBbemhA==",
           "dev": true,
+          "optional": true,
           "requires": {
-            "amdefine": ">=0.0.4"
+            "commander": "~2.20.3",
+            "source-map": "~0.6.1"
           }
         }
       }
@@ -9553,33 +9505,17 @@
           "version": "2.20.0",
           "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz",
           "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==",
-          "dev": true,
           "optional": true
         },
-        "handlebars": {
-          "version": "4.1.2",
-          "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz",
-          "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==",
-          "dev": true,
-          "requires": {
-            "neo-async": "^2.6.0",
-            "optimist": "^0.6.1",
-            "source-map": "^0.6.1",
-            "uglify-js": "^3.1.4"
-          }
-        },
         "source-map": {
           "version": "0.6.1",
           "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
-          "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
-          "dev": true
+          "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
         },
         "uglify-js": {
           "version": "3.6.0",
           "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz",
           "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==",
-          "dev": true,
-          "optional": true,
           "requires": {
             "commander": "~2.20.0",
             "source-map": "~0.6.1"
@@ -12323,13 +12259,6 @@
       "integrity": "sha1-eZllXoZGwX8In90YfRUNMyTVRRM=",
       "dev": true
     },
-    "lazy-cache": {
-      "version": "1.0.4",
-      "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz",
-      "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=",
-      "dev": true,
-      "optional": true
-    },
     "left-pad": {
       "version": "1.3.0",
       "resolved": "https://registry.npmjs.org/left-pad/-/left-pad-1.3.0.tgz",
@@ -13175,13 +13104,6 @@
         "cli-cursor": "^1.0.2"
       }
     },
-    "longest": {
-      "version": "1.0.1",
-      "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz",
-      "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=",
-      "dev": true,
-      "optional": true
-    },
     "loose-envify": {
       "version": "1.4.0",
       "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@@ -13524,9 +13446,9 @@
       }
     },
     "minimist": {
-      "version": "1.2.0",
-      "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz",
-      "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ="
+      "version": "1.2.2",
+      "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.2.tgz",
+      "integrity": "sha512-rIqbOrKb8GJmx/5bc2M0QchhUouMXSpd1RTclXsB41JdL+VtnojfaJR+h7F9k18/4kHUsBFgk80Uk+q569vjPA=="
     },
     "minimist-options": {
       "version": "3.0.2",
@@ -18444,16 +18366,6 @@
       "integrity": "sha1-G0KmJmoh8HQh0bC1S33BZ7AcATs=",
       "dev": true
     },
-    "right-align": {
-      "version": "0.1.3",
-      "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz",
-      "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=",
-      "dev": true,
-      "optional": true,
-      "requires": {
-        "align-text": "^0.1.1"
-      }
-    },
     "right-pad": {
       "version": "1.0.1",
       "resolved": "https://registry.npmjs.org/right-pad/-/right-pad-1.0.1.tgz",
@@ -20422,40 +20334,6 @@
       "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
       "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
     },
-    "uglify-js": {
-      "version": "2.8.29",
-      "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz",
-      "integrity": "sha1-KcVzMUgFe7Th913zW3qcty5qWd0=",
-      "dev": true,
-      "optional": true,
-      "requires": {
-        "source-map": "~0.5.1",
-        "uglify-to-browserify": "~1.0.0",
-        "yargs": "~3.10.0"
-      },
-      "dependencies": {
-        "yargs": {
-          "version": "3.10.0",
-          "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz",
-          "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=",
-          "dev": true,
-          "optional": true,
-          "requires": {
-            "camelcase": "^1.0.2",
-            "cliui": "^2.1.0",
-            "decamelize": "^1.0.0",
-            "window-size": "0.1.0"
-          }
-        }
-      }
-    },
-    "uglify-to-browserify": {
-      "version": "1.0.2",
-      "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz",
-      "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=",
-      "dev": true,
-      "optional": true
-    },
     "umd": {
       "version": "3.0.3",
       "resolved": "https://registry.npmjs.org/umd/-/umd-3.0.3.tgz",
@@ -21336,13 +21214,6 @@
       "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=",
       "dev": true
     },
-    "window-size": {
-      "version": "0.1.0",
-      "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz",
-      "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=",
-      "dev": true,
-      "optional": true
-    },
     "windows-release": {
       "version": "3.1.0",
       "resolved": "https://registry.npmjs.org/windows-release/-/windows-release-3.1.0.tgz",


Test patch:
diff --git a/lib/index.test.js b/lib/index.test.js
new file mode 100644
index 0000000..e5d8013
--- /dev/null
+++ b/lib/index.test.js
@@ -0,0 +1,98 @@
+const browserify = require("@cypress/browserify-preprocessor");
+const { default: preprocessor, transform } = require(".");
+
+jest.mock("@cypress/browserify-preprocessor");
+const { defaultOptions } = jest.requireActual(
+  "@cypress/browserify-preprocessor"
+);
+
+describe("Preprocessor", () => {
+  beforeEach(() => {
+    browserify.defaultOptions = defaultOptions;
+    browserify.mockReturnValue(() => {});
+  });
+
+  afterEach(() => {
+    browserify.mockClear();
+  });
+
+  it("should use Cypress browserify options by default", async () => {
+    await preprocessor()({ shouldWatch: false });
+
+    global.jestExpect(browserify).toHaveBeenCalledWith({
+      ...defaultOptions,
+      browserifyOptions: {
+        ...defaultOptions.browserifyOptions,
+        transform: [transform, ...defaultOptions.browserifyOptions.transform]
+      }
+    });
+  });
+
+  it("should add transform when other transforms are defined in options", async () => {
+    await preprocessor({
+      browserifyOptions: {
+        transform: ["babelify"]
+      }
+    })({ shouldWatch: false });
+
+    global.jestExpect(browserify).toHaveBeenCalledWith({
+      browserifyOptions: {
+        transform: [transform, "babelify"]
+      }
+    });
+  });
+
+  it("should preserve transforms in options when our transform is already included", async () => {
+    const options = {
+      browserifyOptions: {
+        extensions: ["js", "ts"],
+        plugins: [["tsify"]],
+        transform: ["aliasify", transform, "babelify"]
+      }
+    };
+
+    await preprocessor(options)({ shouldWatch: false });
+
+    global.jestExpect(browserify).toHaveBeenCalledWith(options);
+  });
+
+  it("should add our transform when no other transforms are defined in options", async () => {
+    const options = {
+      browserifyOptions: {
+        extensions: ["js", "ts"],
+        plugins: [["tsify"]]
+      }
+    };
+
+    await preprocessor(options)({ shouldWatch: false });
+
+    global.jestExpect(browserify).toHaveBeenCalledWith({
+      ...options,
+      browserifyOptions: {
+        ...options.browserifyOptions,
+        transform: [transform]
+      }
+    });
+  });
+
+  it("should add our transform when browserifyOptions property is not passed to options", async () => {
+    const options = { unsupported: true };
+
+    await preprocessor(options)({ shouldWatch: false });
+
+    global.jestExpect(browserify).toHaveBeenCalledWith({
+      ...options,
+      browserifyOptions: {
+        transform: [transform]
+      }
+    });
+  });
+
+  it("should fail gracefully when options is not an object", () => {
+    const err = new Error("Preprocessor options must be an object");
+
+    global.jestExpect(() => preprocessor("options")).toThrow(err);
+    global.jestExpect(() => preprocessor(1)).toThrow(err);
+    global.jestExpect(() => preprocessor(false)).toThrow(err);
+  });
+});