title: How to import ".mjs" modules in Jest's xyz.test.js?
body: <p>I want to use Import/export feature of ES6 modules (since my entire project uses that) with Jest 26.1.0.</p>
  <p>I have created a directory for my test cases called <code>testCases/</code> which contains a <code>math.mjs</code> file. Now I am trying to import this file in <code>math.test.js</code> (for Jest). Whenever I run <code>npm run test</code>, it throws the following error.</p>
  <pre><code>&gt;Details:
  
      /home/jatin/Downloads/Node.js/task-manager-app/TestCases/math.test.js:1
      import calc from &quot;../src/math.mjs&quot;;
      ^^^^^^
  
      SyntaxError: Cannot use import statement outside a module
  
        at Runtime._execModule (node_modules/jest-runtime/build/index.js:1179:56)
  
  Test Suites: 1 failed, 1 total
  Tests:       0 total
  Snapshots:   0 total
  Time:        1.556 s
  Ran all test suites.
  npm ERR! Test failed.  See above for more details.
  </code></pre>
  <p>I even tried changing Jest configuration,as per the documentation and other GitHub issues but no success so far.</p>
  <p>Below is my math.mjs testing file</p>
  <pre><code>  const calc = (total, tippercent) =&gt; {
      const tip = total * tippercent;
      return total + tip;
  }
  
  export default calc
  </code></pre>
  <p>And this is my math.test.js</p>
  <pre><code>import calc from &quot;../src/math.mjs&quot;;
  
  test(&quot;to calculate tipercent&quot;, () =&gt; {});
  </code></pre>
  <p>How can we configure Jest to parse .mjs modules?</p>