title: jest ReferenceError: Cannot access '' before initialization
body: <p>I'm getting the error:</p>
  <p><code>ReferenceError: Cannot access 'myMock' before initialization</code></p>
  <p>Even though i respected jest documentation about the hoisting:
  <a href="https://jestjs.io/docs/en/es6-class-mocks#calling-jestmockdocsenjest-objectjestmockmodulename-factory-options-with-the-module-factory-parameter" rel="noreferrer"><code>A limitation with the factory parameter is that, since calls to jest.mock() are hoisted to the top of the file, it's not possible to first define a variable and then use it in the factory. An exception is made for variables that start with the word 'mock'.</code></a></p>
  <p>I'm doing this:</p>
  <pre class="lang-js prettyprint-override"><code>import MyClass from './my_class';
  import * as anotherClass from './another_class';
  
  const mockMethod1 = jest.fn();
  const mockMethod2 = jest.fn();
  jest.mock('./my_class', () =&gt; {
    return {
      default: {
        staticMethod: jest.fn().mockReturnValue(
          {
            method1: mockMethod1,
            method2: mockMethod2,
          })
      }
    }
  });
  </code></pre>
  <p>as you can see both of my variables respect the &quot;standard&quot; but are not hoisted properly.</p>
  <p>Am I missing something ?</p>
  <p>Obviously it works when I just pass <code>jest.fn()</code> instead of my variables, but i'm not sure how to be able to use these in my test later on.</p>