title: Jest: Cannot use import statement outside a module
body: <p>I got an error when I run test using Jest, I tried to fix this error for 2 hours. But, I couldn't fix it. My module is using <code>gapi-script</code> package and error is occurred in this package. However, I don't know why this is occurred and how to fix it.</p>
  
  <p><strong>jest.config.js</strong></p>
  
  <pre><code>module.exports = {
    "collectCoverage": true,
    "rootDir": "./",
    "testRegex": "__tests__/.+\\.test\\.js",
    "transform": {
      '^.+\\.js?$': "babel-jest"
    },
    "moduleFileExtensions": ["js"],
    "moduleDirectories": [
      "node_modules",
      "lib"
    ]
  }
  </code></pre>
  
  <p><strong>babel.config.js</strong></p>
  
  <pre><code>module.exports = {
    presets: [
      '@babel/preset-env',
    ]
  };
  </code></pre>
  
  <p><strong>methods.test.js</strong></p>
  
  <pre><code>import methods, { typeToActions } from '../lib/methods';
  </code></pre>
  
  <p><strong>methods.js</strong></p>
  
  <pre><code>import { gapi } from "gapi-script";
  ...
  </code></pre>
  
  <p><strong>Error Message</strong></p>
  
  <blockquote>
    <p>C:\haram\github\react-youtube-data-api\node_modules\gapi-script\index.js:1
        ({"Object.":function(module,exports,require,__dirname,__filename,global,jest){import
    { gapi, gapiComplete } from './gapiScript';</p>
  
  <pre><code>SyntaxError: Cannot use import statement outside a module
  </code></pre>
  </blockquote>
  
  <p>What is wrong with my setting?</p>