title: Jest test: Cannot find module, in typescript component import
body: <p>The path to my styled objects is correct, however not sure why I'm getting the following error:</p>
  <blockquote>
  <p>Cannot find module '../../shared/models' from 'Astronaut.tsx'</p>
  <p>import { moonHoldings } from '../../shared/models';</p>
  </blockquote>
  <p>My simple Jest test:</p>
  <pre><code>import React from 'react';
  import { shallow } from 'enzyme';
  import toJson from 'enzyme-to-json';
  
  // @ts-ignore (works with .tsx)
  import Astronaut from '../Astronaut.tsx';
  
  describe('&lt;Astronaut /&gt; component', () =&gt; {
    describe('should render', () =&gt; {
      const wrapper = shallow(&lt;Astronaut showLogo={true} /&gt;);
      it ('should render a component matching the snapshot', () =&gt; {
        const tree = toJson(wrapper);
        expect(tree).toMatchSnapshot();
        expect(wrapper).toHaveLength(1);
      });
    });
  });
  </code></pre>
  <p>The Astronaut component</p>
  <pre><code>import React from 'react';
  
  import { moonHoldings } from '../../shared/models';  // &lt;-- The problem
  import { astronaut } from '../../styles'; // &lt;-- This works
  
  const { AstronautContainer, Heading } = astronaut;
  
  interface LogoCheck {
    showLogo: boolean;
  }
  
  export default (showLogo: LogoCheck) =&gt;  (
    &lt;AstronautContainer&gt;
      { showLogo.showLogo === true ? &lt;Heading&gt;{moonHoldings}&lt;/Heading&gt; : null }
      &lt;img src=&quot;static/astronaut.png&quot; alt=&quot;astronaut&quot; /&gt;
    &lt;/AstronautContainer&gt;
  );
  </code></pre>
  <p>The Jest config section of my Package.json</p>
  <pre><code>&quot;jest&quot;: {
    &quot;setupTestFrameworkScriptFile&quot;: &quot;&lt;rootDir&gt;/jest.setup.js&quot;,
    &quot;testPathIgnorePatterns&quot;: [
      &quot;&lt;rootDir&gt;/.next/&quot;,
      &quot;&lt;rootDir&gt;/node_modules/&quot;
    ],
    &quot;transform&quot;: {
      &quot;\\.(gql|graphql)$&quot;: &quot;jest-transform-graphql&quot;,
      &quot;.*&quot;: &quot;babel-jest&quot;,
      &quot;^.+\\.js?$&quot;: &quot;babel-jest&quot;
    },
    &quot;moduleFileExtensions&quot;: [
      &quot;js&quot;,
      &quot;json&quot;,
      &quot;ts&quot;,
      &quot;tsx&quot;
    ],
    &quot;modulePaths&quot;: [
      &quot;&lt;rootDir&gt;/components/&quot;,
      &quot;&lt;rootDir&gt;/pages/&quot;,
      &quot;&lt;rootDir&gt;/shared/&quot;
    ]
  }
  </code></pre>
  <p>And my folder structure:</p>
  <p><a href="https://i.stack.imgur.com/unqiT.png" rel="noreferrer"><img src="https://i.stack.imgur.com/unqiT.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/R3x2i.png" rel="noreferrer"><img src="https://i.stack.imgur.com/R3x2i.png" alt="enter image description here" /></a></p>