title: jest mocking on relative path
body: <p>I'm trying to get jest mocking to work on a relative path. The same code but with mocking <code>fs</code> worked great, so I'm not sure why trying to mock my own modules doesn't work</p>
  
  <pre><code>// myFile.js
  const { cacheFile } = require('./cacheHandler.js')
  
  const myFunc = () =&gt; {
    cacheFile(file_name)
  }
  
  // myFile.spec.js
  
  const myFile = require('./myFile.js')
  const cacheHandler = require('./cacheHandler.js')
  
  jest.mock('./cacheHandler.js')
  
  describe("my failing test :( ", () =&gt;{
    it("should be able to spy on the function", () =&gt; {
      cacheHandler.cacheFile = jest.fn()
  
      myFile.myFunc()
  
      expect(cacheHandler.cacheFile).toHaveBeenCalledTimes(1)   
    }
  }
  </code></pre>
  
  <p>jest claims that the cacheFile() was never called, eventhough when I debug this I can see that it reached this function...</p>
  
  <p>What am I missing?</p>