title: Cannot use import statement outside a module in test file
body: <p>I'm trying to setup a test environment with Jest for a React project with Typescript. However, i encounter <code>SyntaxError: Cannot use import statement outside a module</code> error while i am trying to run a test. Here is my setup and error message;</p>
  <h3>api/promo.test.ts</h3>
  <pre><code>import { getDiscountedAmount } from '@/api/promo';
  import { Money } from '@bit/together-price.core.monetary';
  
  describe('api/promo.ts', () =&gt; {
    it('should display pass in number', () =&gt; {
      const amount = Money.from({ value: 5, currency: 'EUR' });
      const discount = Money.from({ value: 2, currency: 'EUR' });
      const discountedAmount = getDiscountedAmount(amount, discount);
      expect(discountedAmount.value).toBe(3);
    });
  });
  </code></pre>
  <h3>@/api/promo.ts</h3>
  <pre><code>import { Money, MoneyLike } from '@bit/together-price.core.monetary';
  
  export const getDiscountedAmount = (
    amount: MoneyLike,
    discount: MoneyLike
  ): Money =&gt;
    Money.max(Money.from(amount).subtract(discount), Money.zero(amount.currency));
  </code></pre>
  <h3>babel.config.js</h3>
  <pre><code>module.exports = {
    presets: [
      '@babel/preset-env',
      '@babel/preset-react',
      '@babel/preset-typescript',
    ],
    plugins: [
      [
        '@babel/plugin-transform-runtime',
        {
          useESModules: true,
          regenerator: false,
        },
      ],
    ],
    env: {
      test: {
        presets: [
          [
            '@babel/preset-env',
            {
              targets: 'current node',
            },
          ],
        ],
      },
    },
  };
  </code></pre>
  <h3>jest.config.ts</h3>
  <pre><code>export default {
     preset: 'ts-jest',
     testEnvironment: 'node',
     clearMocks: true,
     collectCoverage: true,
     transform: {
         '^.+\\.ts?$': 'ts-jest',
     },
     transformIgnorePatterns: ['&lt;rootDir&gt;/node_modules/'],
  }
  </code></pre>
  <h3>package.json</h3>
  <pre><code>{
        ...
        &quot;scripts&quot;: {
          ...
          &quot;test&quot;: &quot;jest&quot;
        },
        &quot;devDependencies&quot;: {
          &quot;@babel/core&quot;: &quot;^7.17.12&quot;,
          &quot;@babel/plugin-transform-runtime&quot;: &quot;^7.8.3&quot;,
          &quot;@babel/preset-env&quot;: &quot;^7.17.12&quot;,
          &quot;@babel/preset-react&quot;: &quot;^7.7.4&quot;,
          &quot;@babel/preset-typescript&quot;: &quot;^7.9.0&quot;,
          &quot;@babel/runtime&quot;: &quot;^7.8.7&quot;,
          &quot;@testing-library/react&quot;: &quot;^9.4.0&quot;,
          &quot;@types/jest&quot;: &quot;^27.5.1&quot;,
          &quot;@types/react&quot;: &quot;16.9.11&quot;,
          &quot;@types/react-dom&quot;: &quot;16.9.4&quot;,
          &quot;@types/react-router-dom&quot;: &quot;^5.1.6&quot;,
          &quot;@types/systemjs&quot;: &quot;^6.1.0&quot;,
          &quot;@types/webpack-env&quot;: &quot;^1.16.0&quot;,
          &quot;@typescript-eslint/eslint-plugin&quot;: &quot;^4.9.1&quot;,
          &quot;@typescript-eslint/parser&quot;: &quot;^4.9.1&quot;,
          &quot;babel-eslint&quot;: &quot;^11.0.0-beta.2&quot;,
          &quot;babel-jest&quot;: &quot;^28.1.0&quot;,
          ...
          &quot;jest&quot;: &quot;^28.1.0&quot;,
          ...
          &quot;ts-jest&quot;: &quot;^28.0.2&quot;,
          &quot;ts-node&quot;: &quot;^10.7.0&quot;,
          &quot;typescript&quot;: &quot;^4.1.5&quot;,
          &quot;webpack&quot;: &quot;^5.18.0&quot;,
          &quot;webpack-cli&quot;: &quot;^4.4.0&quot;,
          &quot;webpack-dev-server&quot;: &quot;^4.0.0-beta.0&quot;,
          &quot;webpack-merge&quot;: &quot;^5.7.3&quot;
        },
        &quot;dependencies&quot;: {
          ...
          &quot;react&quot;: &quot;^16.12.0&quot;,
          &quot;react-dom&quot;: &quot;^16.12.0&quot;,
          ...
        }
      }
  </code></pre>
  <h3>Error</h3>
  <pre><code>({&quot;Object.&lt;anonymous&gt;&quot;:function(module,exports,require,__dirname,__filename,jest){import { getI18n } from 'react-i18next';
                                                                                        ^^^^^^
  
      SyntaxError: Cannot use import statement outside a module
  
      &gt; 1 | import { Money } from '@bit/together-price.core.monetary';
          | ^
        2 |
        3 | describe('api/promo.ts', () =&gt; {
        4 |   it('should display pass in number', () =&gt; {
  
        at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1773:14)
        at Object.&lt;anonymous&gt; (src/__tests__/api/promo.test.ts:1:1)
  </code></pre>