title: React Jest test fails to run with ts-jest - Unexpected token on imported file
body: <p>I have a test for a test for a TSX file written in a JSX file which fails to run due to unexpected token:</p>
  
  <pre><code>Test suite failed to run
  
      Jest encountered an unexpected token
  
      This usually means that you are trying to import a file which Jest cannot parse, e.g. it's not plain JavaScript.
  
      By default, if Jest sees a Babel config, it will use that to transform your files, ignoring "node_modules".
  </code></pre>
  
  <p>I have another test written in JSX for a JSX file which does run. I am using React Testing Library but I don't think this is the issue as the test fails on the file imports.</p>
  
  <p><strong>Stack trace:</strong></p>
  
  <pre><code> export { default as add } from './add.js';
  ^^^^^^
  
  SyntaxError: Unexpected token export
  
    1 | import React from 'react';
  &gt; 2 | import { debounce } from 'lodash-es';
      | ^
    3 | 
    4 | interface Props {
    5 |   bodyContent?: string
  
    at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
    at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
    at Object.&lt;anonymous&gt; (components/tsx/TestComponentTSX.tsx:2:1)`
  </code></pre>
  
  <p><strong>Jest config:</strong></p>
  
  <pre><code>module.exports = {
    moduleDirectories: [
      'node_modules'
    ],
    transform: {
      "\\.tsx?$": "ts-jest",
      "\\.jsx?$": "babel-jest",
    },
    globals: {
      "ts-jest": {
        "tsConfig": '&lt;rootDir&gt;/tsconfig.json'
      }
    }
  }
  </code></pre>
  
  <p><strong>TS Config:</strong></p>
  
  <pre><code>{
    "compilerOptions": {
      "outDir": "./dist/",
      "noImplicitAny": true,
      "module": "es6",
      "target": "es5",
      "jsx": "react",
      "allowJs": true,
      "allowSyntheticDefaultImports": true
    }
  }
  </code></pre>
  
  <p><strong>TestComponentTSX.tsx</strong></p>
  
  <pre><code>import React from 'react';
  import { debounce } from 'lodash-es';
  
  interface Props {
    bodyContent?: string
  }
  
  function TestComponentTSX(props: Props) {
  
    const clickHandler = (): void =&gt; {
      console.log('I am being clicked!');
    };
  
    const debouncedClickHandler = debounce(clickHandler, 400)
  
    return (
      &lt;div&gt;
        &lt;h1&gt;Hello World!&lt;/h1&gt;
        &lt;p&gt;{props.bodyContent || 'World...'}&lt;/p&gt;
        &lt;button type="button" onClick={debouncedClickHandler}&gt;Click me!&lt;/button&gt;
      &lt;/div&gt;
    )
  }
  
  export default TestComponentTSX;
  </code></pre>
  
  <p><strong>TestComponentTSX.test.tsx</strong></p>
  
  <pre><code>import React from 'react';
  import { render } from '@testing-library/react';
  import TestComponentTSX from './TestComponentTSX';
  
  describe('The TSX component is testable', () =&gt; {
    test('The component renders', () =&gt; {
      // Arrange
      const { getByText } = render(
        &lt;TestComponentTSX /&gt;
      );
  
      // Act
      // Do something
  
      // Assert
      expect(getByText('Hello World!'));
    })
  });
  </code></pre>
  
  <p><strong>package.json</strong></p>
  
  <pre><code>{
    "name": "jesttypescriptreact",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
      "build-dev": "cross-env NODE_ENV=development webpack"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
      "lodash-es": "^4.17.15",
      "react": "^16.10.1",
      "react-dom": "^16.10.1"
    },
    "devDependencies": {
      "@babel/core": "^7.6.2",
      "@babel/plugin-proposal-class-properties": "^7.5.5",
      "@babel/plugin-proposal-object-rest-spread": "^7.6.2",
      "@babel/preset-env": "^7.6.2",
      "@babel/preset-react": "^7.0.0",
      "@babel/preset-typescript": "^7.6.0",
      "@testing-library/react": "^9.2.0",
      "@types/jest": "^24.0.18",
      "@types/lodash-es": "^4.17.3",
      "@types/react-dom": "^16.9.1",
      "babel-loader": "^8.0.6",
      "cross-env": "^6.0.0",
      "jest": "^24.9.0",
      "ts-jest": "^24.1.0",
      "ts-loader": "^6.2.0",
      "typescript": "^3.6.3",
      "webpack": "^4.41.0",
      "webpack-cli": "^3.3.9"
    }
  }
  </code></pre>