title: Absolute path regex in jest.config.js
body: <p>I would like to match absolute paths with regex in my <code>jest.config.js</code> same way as it is done in <code>jsconfig.json</code>.</p>
  <pre><code> // jest.config.js
   {
     ...
     moduleNameMapper: {
       '^\+\/(.*)$': '&lt;rootDir&gt;/src/styles/'
       '^\~\/(.*)$': '&lt;rootDir&gt;/src/'
    },
   }
  </code></pre>
  <p><code>'^\+\/(.*)$'</code> should match <code>+/theme/theme</code> and find file located in <code>Project/src/styles/theme/theme</code></p>
  <p><code>'^\~\/(.*)$'</code> should match <code>'~/components/Account'</code> and find file located in <code>Project/src/components/Account</code></p>
  <p>Regex work: <a href="https://regex101.com/r/yXpeAu/1" rel="nofollow noreferrer">https://regex101.com/r/yXpeAu/1</a>, <a href="https://regex101.com/r/jH6ajA/1" rel="nofollow noreferrer">https://regex101.com/r/jH6ajA/1</a></p>
  <p>Unfortunately something is wrong because I got 2 errors during test run.</p>
  <ul>
  <li><code>SyntaxError: Invalid regular expression: /^+/(.*)$/: Nothing to repeat</code></li>
  <li><code>Cannot find module './src/components/Account' from 'src/components/Account</code></li>
  </ul>
  <p>This is how jsconfig.json resolve absolute paths:</p>
  <pre><code>// jsconfig.json
  {
    &quot;baseUrl&quot;: &quot;.&quot;,
    &quot;paths&quot;: {
    &quot;+/*&quot;: [&quot;./src/styles/*&quot;],
    &quot;~/*&quot;: [&quot;./src/*&quot;],
    }
  }
  </code></pre>