title: jest.fn() inside jest.mock() returns undefined
body: <p>I'm having a simple &quot;util&quot; module with a default export and 2 named exports.</p>
  <pre class="lang-js prettyprint-override"><code>const foo = () =&gt; 'foo'
  export default foo
      
  export const bar = () =&gt; 'bar'
  export const baz = () =&gt; 'baz'
  </code></pre>
  <p>on my test, I'm mocking it like that :</p>
  <pre class="lang-js prettyprint-override"><code>jest.mock('./util', () =&gt; ({
    __esModule: true,
    default: jest.fn(() =&gt; 'mocked foo'),
    bar: jest.fn(() =&gt; 'mocked bar'),
    baz: jest.fn(() =&gt; 'mocked baz'),
  }))
  
  describe('util', () =&gt; {
    //...
  })
  </code></pre>
  <p>On my component, when I call <code>foo()</code>, <code>bar()</code> or <code>baz()</code>, I received <code>undefined</code>.
  but everything is working if I remove <code>jest.fn()</code> like that :</p>
  <pre class="lang-js prettyprint-override"><code>jest.mock('./util', () =&gt; ({
    __esModule: true,
    default: () =&gt; 'mocked foo',
    bar: () =&gt; 'mocked bar',
    baz: () =&gt; 'mocked baz',
  }))
  </code></pre>
  <p>My example is very close to the one on jest doc :
  <a href="https://jestjs.io/docs/mock-functions#mocking-partials" rel="nofollow noreferrer">https://jestjs.io/docs/mock-functions#mocking-partials</a></p>
  <p>I'm using <strong>React</strong> (CRA) and <strong>TypeScript</strong></p>
  <p>I know there is different ways to mock a module but I'm curious to understand the issue that I'm facing.</p>
  <p>any idea what I'm doing wrong ? :)
  Thanks !</p>