title: ES6/Mocha Include Files
body: <p>I'm quite new to ES6 export/import syntax and I would like to know how to dynamically import files with tests inside my <code>indexTest.js</code> file.</p>
  
  <p>I have 2 files with tests.</p>
  
  <p><code>PeopleTest.js</code></p>
  
  <pre><code>/* global it, describe, before, after */
  /* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
  
  import chai, { expect } from 'chai';
  import dirtyChai from 'dirty-chai';
  
  chai.use(dirtyChai);
  
  describe('People tests', () =&gt; {
    it('Mock', () =&gt; {
      expect(true).to.be.true();
    });
  });
  </code></pre>
  
  <p><code>PostTest.js</code></p>
  
  <pre><code>/* global it, describe, before, after */
  /* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
  
  import chai, { expect } from 'chai';
  import dirtyChai from 'dirty-chai';
  
  chai.use(dirtyChai);
  
  describe('Post tests', () =&gt; {
    it('Mock', () =&gt; {
      expect(true).to.be.true();
    });
  });
  </code></pre>
  
  <p>And I would like to have a global file to import these two files</p>
  
  <p><code>indexTest.js</code></p>
  
  <pre><code>/* global it, describe, before, after */
  /* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */
  
  import chai, { expect } from 'chai';
  import dirtyChai from 'dirty-chai';
  
  chai.use(dirtyChai);
  
  describe('All tests', () =&gt; {
    before(() =&gt; {
      // some stuff
    });
  
    after(() =&gt; {
      // some stuff
    });
  
    import './PeopleTest';
    import './PostTest';
  });
  </code></pre>
  
  <p>But of course its not working because <code>import</code> statement should be at the top level.</p>