title: How to debug Jest unit test for a debounced function
body: <p>I have the following function:</p>
  
  <pre><code>myFunction = _.debounce((viewport) =&gt; {
      ...
      otherFunction();
      ...
      someOtherFunction();
      ...
  }, 650)
  </code></pre>
  
  <p>I'm trying to use jest to assert whether the <code>otherFunction</code> and <code>someOtherFunction</code> were run. In order to do this, I wanted to use WebStorm's debugger to check the function flow.</p>
  
  <p>I've tried mocking the <code>_.debounce</code>:</p>
  
  <pre><code>_.debounce = jest.fn((fn) =&gt; fn);
  </code></pre>
  
  <p>Even though I tried adding a spy on the <code>myFunction</code> and jest says that the function ran, I can't make the debugger stop inside the function.</p>
  
  <p>If I try to remove the <code>_.debounce</code> function, the debugger stops successfully.</p>
  
  <p>Is there any way to make this work?</p>