title: How to mock third party modules with Jest
body: <p>I've got current import in my test target:</p>
  
  <pre><code>import sharp from 'sharp'
  </code></pre>
  
  <p>and using it with in my same test target:</p>
  
  <pre><code>return sharp(local_read_file)
      .raw()
      .toBuffer()
      .then(outputBuffer =&gt; {
  </code></pre>
  
  <p>In my test, I'm doing below to mock sharp functions:</p>
  
  <pre><code>jest.mock('sharp', () =&gt; {
    raw: jest.fn()
    toBuffer: jest.fn()
    then: jest.fn()
  })
  </code></pre>
  
  <p>but I'm getting:</p>
  
  <pre><code>  return (0, _sharp2.default)(local_read_file).
                               ^
  TypeError: (0 , _sharp2.default) is not a function
  </code></pre>
  
  <p>Is there a way we can mock all Sharp module functions using Jest with the function?</p>