How do I move jest tests to a /test folder and get them to run?
<p><strong>edit</strong>: I'm pretty sure this question is out of date and Jest has changed since then. Don't assume the answers will work or even be relevant now.</p>
<p>Jest expects tests to be in _<em>tests</em>_ folder or to be named blah.test.js. I don't like either of those patterns. I want my test files to be in <code>/test</code> and naming them <code>test/index.ios.test.js</code> seems redundant and silly. My first stab at this is to change my jest config in package.json to be:</p>
<pre><code>&quot;jest&quot;: {
    &quot;testPathDirs&quot;: [&quot;test&quot;],
    &quot;testRegex&quot;: &quot;\\.(js|jsx)$&quot;,
    &quot;preset&quot;: &quot;react-native&quot;
}
</code></pre>
<p>Which find the tests successfully but they all fail:</p>
<pre><code>Cannot find module 'setupDevtools' from 'setup.js'
  
  at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:151:17)
  at Object.&lt;anonymous&gt; (node_modules/react-native/jest/setup.js:23:1)
</code></pre>
<p>That function is in <code>node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js</code>. How do I tell Jest where to find it?</p>