title: setInterval not working when testing with jest
body: <p>I got a class on which I'm trying to run Jest tests. The class (not the test) is using an interval inside. I'm trying to test it with some method I created in the test like this:</p>
  
  <pre><code>const syncWait = ms =&gt; 
      {
          const end = Date.now() + ms;
          while (Date.now() &lt; end) continue;
      };
      let myObj = new MyClass(); //the constructor starts the interval
      syncWait(5500);
      expect(...
  </code></pre>
  
  <p>However, it seems like the interval from the class itself is not being executed. I put some console.logs and saw it does arrive to the point in code in which the interval is set like this:</p>
  
  <pre><code>this.intervalId = setInterval(() =&gt; this.sendIntervalMessage(), this.timeUntilSendMessages); //time here is 3000
  </code></pre>
  
  <p>however it simply won't execute even after the time of the interval has passed. Why is that?</p>