title: Cannot find module 'enzyme' from 'setupTests.ts'
body: <p>I want to use enzyme to perform unit tests in my React project with TypeScript.</p>
  <p>I used documentation on adding tests to create-react-app - <a href="https://facebook.github.io/create-react-app/docs/running-tests" rel="noreferrer">runnning tests</a></p>
  <p>I created a setupTests.ts file in /src</p>
  <p><strong>setupTests.ts</strong></p>
  <pre><code>import { configure } from 'enzyme';
  import Adapter from 'enzyme-adapter-react-16';
  
  configure({ adapter: new Adapter() });
  </code></pre>
  <p>And I wrote a test</p>
  <p><strong>App.test.ts</strong></p>
  <pre><code>import React from 'react';
  import { shallow } from 'enzyme';
  import App from './App';
  
  it('renders without crashing', () =&gt; {
    shallow(&lt;App /&gt;);
  });
  
  </code></pre>
  <p>A test using react-dom works fine if I comment the line which configures adapter in setupTests.ts</p>
  <p><strong>setupTests.ts</strong></p>
  <pre><code>import { configure } from 'enzyme';
  import Adapter from 'enzyme-adapter-react-16';
  
  // configure({ adapter: new Adapter() });
  </code></pre>
  <p><strong>App.test.ts</strong></p>
  <pre><code>import React from 'react';
  import ReactDOM from 'react-dom';
  import App from './components/Dashboard';
  
  it('renders without crashing', () =&gt; {
    const div = document.createElement('div');
    ReactDOM.render(&lt;App /&gt;, div);
  });
  </code></pre>
  <p><strong>package.json</strong></p>
  <pre><code>{
    &quot;name&quot;: &quot;sampleapp&quot;,
    &quot;version&quot;: &quot;0.1.0&quot;,
    &quot;private&quot;: true,
    &quot;dependencies&quot;: {
      &quot;@material-ui/core&quot;: &quot;^3.9.2&quot;,
      &quot;@material-ui/icons&quot;: &quot;^3.0.2&quot;,
      &quot;@types/enzyme&quot;: &quot;^3.9.1&quot;,
      &quot;@types/enzyme-adapter-react-16&quot;: &quot;^1.0.5&quot;,
      &quot;@types/enzyme-to-json&quot;: &quot;^1.5.3&quot;,
      &quot;@types/jest&quot;: &quot;24.0.11&quot;,
      &quot;@types/node&quot;: &quot;11.12.0&quot;,
      &quot;@types/react&quot;: &quot;16.8.8&quot;,
      &quot;@types/react-dom&quot;: &quot;16.8.3&quot;,
      &quot;@types/react-redux&quot;: &quot;^7.0.5&quot;,
      &quot;@types/react-router-dom&quot;: &quot;^4.3.1&quot;,
      &quot;@types/redux-thunk&quot;: &quot;^2.1.0&quot;,
      &quot;axios&quot;: &quot;^0.18.0&quot;,
      &quot;react&quot;: &quot;^16.8.5&quot;,
      &quot;react-dom&quot;: &quot;^16.8.5&quot;,
      &quot;react-redux&quot;: &quot;^6.0.1&quot;,
      &quot;react-router-dom&quot;: &quot;^5.0.0&quot;,
      &quot;react-scripts&quot;: &quot;2.1.8&quot;,
      &quot;redux&quot;: &quot;^4.0.1&quot;,
      &quot;redux-thunk&quot;: &quot;^2.3.0&quot;,
      &quot;typescript&quot;: &quot;3.3.4000&quot;
    },
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;react-scripts start&quot;,
      &quot;build&quot;: &quot;react-scripts build&quot;,
      &quot;test&quot;: &quot;react-scripts test&quot;,
      &quot;eject&quot;: &quot;react-scripts eject&quot;
    },
    &quot;eslintConfig&quot;: {
      &quot;extends&quot;: &quot;react-app&quot;
    },
    &quot;browserslist&quot;: [
      &quot;&gt;0.2%&quot;,
      &quot;not dead&quot;,
      &quot;not ie &lt;= 11&quot;,
      &quot;not op_mini all&quot;
    ]
  }
  </code></pre>
  <p>The test is supposed to run successfully. But it is failing and giving me an error</p>
  <p><code>Cannot find module 'enzyme' from 'setupTests.ts'</code></p>