title: Jest Mock User Module in All Test Files
body: <blockquote>
    <p>Is there a way to make it so that jest always mocks my modules so I don't need to include it in all my jest tests? </p>
  </blockquote>
  
  <p>Currently I have a config file</p>
  
  <pre><code>// src/__mocks__/config.js 
  export default {
    dbConfig: 'TestDBConfiguration'
  };
  
  // src/config.js
  export default {
    dbConfig: ... // Some other stuff
  };
  </code></pre>
  
  <p>To run my unit tests I have to use the mocked <strong>config.js</strong>.
  Currently in all my unit tests I have to include <strong>jest.mock('../config');</strong></p>
  
  <pre><code>// org.test.js
  jest.mock('../../config');
  import db from '../db';              // This internally uses the config file
  import otherFile from '../otherFile'; // This also uses the config file
  
  // Code that calls both db/otherFile
  </code></pre>
  
  <p>Sometimes when I create a test I might forget to include <strong>jest.mock('../config')</strong> which is one of the reasons why I want it included in all my tests.</p>
  
  <p>I've looked into enabling <code>automock</code> but it seems to break my tests instead. <a href="https://facebook.github.io/jest/docs/en/configuration.html#automock-boolean" rel="noreferrer">https://facebook.github.io/jest/docs/en/configuration.html#automock-boolean</a></p>