title: Jest mockImplementation on single function within module
body: <p>Hi there I am just trying to use jest to jest my image min module, the issue I am having is when using imagemin it creates its own tmp folder within a child process which just screws with the path because I am using mock-fs. So all I want to do is have a single function within the module return a predetermined result which will then be passed to another function. </p>
  
  <p>So far in my jest I have </p>
  
  <pre><code>it('Should compress jpg', () =&gt; {
      expect.assertions(1);
      let mock = jest.fn();
      mock.mockReturnValueOnce(true);
      utility.compress = mock;
  
      let opts = {};
      let dest = './tmp/dest/img';
      let file = path.join(dest, 'jpeg_img.jpg');
  
      return utility.imageCompress(['./dummy_data/img/*.jpg'], dest, opts)
        .then(data =&gt; {
          expect(data).toEqual([]);
          expect(fs.existsSync(file)).toBe(true);
          expect(fs.statSync('./dummy_data/img/jpeg_img.jpg').size)
            .toBeLessThan(fs.statSync(file).size);
        });
    });
  </code></pre>
  
  <p>So the <code>utility.imageCompress</code> calls the <code>compress function</code> </p>
  
  <p>I am exporting the function but I still get <code>utility.compress.mockImplementation is not a function</code>.</p>
  
  <p>Any help would be great thanks </p>