visionmedia/mocha — Issue #237: Reports fake times when used with sinon.useFakeTimers().
Author: DomenicDenicola
Created: 2012-01-26 18:58:25+00:00
State: open

Sinon has the ability to fake the clock. Usually one uses it like so:

```javascript
describe("My thing", function () {
var clock = null;

beforeEach(function () {
clock = sinon.useFakeTimers();
});

afterEach(function () {
clock.restore();
});

it("should be cool", function () {
it.should.be("cool");
clock.tick(200);
it.should.be("still cool");
});
});
```

However, if you do this, the reporters tell you your test took 200 ms, and it's all red and sad.

Presumably whatever code is counting the time elapsed is using the time APIs Sinon is messing with. But, hopefully the measurements could be moved to before/after the `beforeEach`/`afterEach` hooks get executed, so you could use unmolested time APIs.

I'll look into it further and hopefully get a pull request together, but I thought I'd document it here while it's still fresh in my mind.