Testing AMD modules with tape/ES6 unit tests?
<p>I have a web app using:</p>

<ul>
<li>ES5</li>
<li>RequireJS</li>
<li>Underscore</li>
<li>Backbone</li>
<li>jQuery</li>
</ul>

<p>I have tried setting up a new unit test suite using:</p>

<ul>
<li>ES6</li>
<li>Tape</li>
<li>Babel6</li>
</ul>

<p>My AMD module app/util/stringUtil.js:</p>

<pre><code>define([], function() {
    'use strict';

    return {
        isBlank: function(str) {
            return _.isUndefined(str) || _.isNull(str) || _.isString(str) &amp;&amp; str.trim().length === 0;
        }
    };
});
</code></pre>

<p>My unit test in tapeTest.js:</p>

<pre><code>import test from 'tape';
import sortUtil from 'app/util/stringUtil';

test('Testing stringUtil', (assert) =&gt; {

    assert.ok(stringUtil.isBlank('   ')),
        'Should be blank');

    assert.end();
});
</code></pre>

<p>My .babelrc:</p>

<pre><code>{
  "presets": ["es2015"]
}
</code></pre>

<p>I run the test with tape:</p>

<pre><code>tape -r babel-register tapeTest.js
</code></pre>

<p>I get the following error:</p>

<pre><code>app/util/stringUtil.js:1
(function (exports, require, module, __filename, __dirname) { define([], function () {
                                                              ^
ReferenceError: define is not defined
    at Object.&lt;anonymous&gt; (stringUtil.js:1:23)
    at Module._compile (module.js:434:26)
    at loader (node_modules/babel-register/lib/node.js:126:5)
    at Object.require.extensions.(anonymous function) [as .js] (node_modules/babel-register/lib/node.js:136:7)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.&lt;anonymous&gt; (tapeTest.js:7:17)
    at Module._compile (module.js:434:26)
</code></pre>

<p>I'm guessing tape doesn't recognize AMD modules? Can I fix this somehow? Maybe transpile AMD modules to CommonJS modules or something?</p>