title: How jasmine clock works?
body: <p>I don't want to read code for hours to find the relevant part, but I am curious how jasmine implements its clock. The interesting thing with it is that it can test async code with sync testing code. AFAIK, with the current node.js, which supports ES5, this is not possible (async functions are defined in ES7). Does it parse the js code with something like estraverse and build an async test from the sync one?</p>
  
  <p>Just an example of what I am talking about:</p>
  
  <pre><code>it("can test async code with sync testing code", function () {
      jasmine.clock().install();
  
      var i = 0;
      var asyncIncrease = function () {
          setTimeout(function () {
              ++i;
          }, 1);
      };
  
      expect(i).toBe(0);
      asyncIncrease();
      expect(i).toBe(0);
      jasmine.clock().tick(2);
      expect(i).toBe(1);
  
      jasmine.clock().uninstall();
  });
  </code></pre>
  
  <p>In here the <code>expect(i).toBe(1);</code> should be in a callback.</p>