Jest Ignore react peer dependency in linked module
<p>I'm working on a React web app that uses a component library we include as an npm module. Because I'm working on the library and the webapp at the same time, I linked the library as module in npm.</p>

<p>The directories are set up like this:</p>

<pre><code>~/Development/
|
|-- myWebapp/
|   |-- package.json # (react included here as dependency)
|   |-- src/
|   |-- node_modules/
|       |-- jest-cli/
|       |-- react/
|       |-- myLibrary/ -&gt; /usr/local/lib/node_modules/myLibrary
|
|-- myLibrary/       # (linked to /usr/local/lib/node_modules by npm link)
|   |-- package.json
|   |-- src/
|   |-- node_modules/
|       |-- react/   # (included as a devDependency and peerDependency)
</code></pre>

<p>I'm writing my tests in Jest (0.8.2). </p>

<p>I'm trying to configure Jest to not load React from myLibrary/node_modules/react when I run tests for myWebapp. Loading React twice tends to cause problems. My tests pass if I <code>rm -r myLibrary/node_modules/react</code> before I run them, but it's a pain to uninstall and reinstall React all the time.</p>

<p>I tried to configure Jest with:</p>

<pre><code>...,
"modulePathIgnorePatterns": [ 
    "&lt;rootDir&gt;/node_modules/myLibrary/node_modules/react"
],
... 
</code></pre>

<p>but that did not seem to work</p>