visionmedia/mocha — Issue #246: How to patch `it`?
Author: alexeypetrushin
Created: 2012-01-31 19:23:30+00:00
State: open

I tried to implement `it.sync` for pseudo-synchronous mode with fibers.

``` CoffeeScript
it.sync "should provide handy shortcuts to collections", ->
$db.collection('test').name.should.eql 'test'
```

with this code:

``` CoffeeScript
it.sync = (desc, callback) ->
it desc, (done) ->
Fiber(->
callback(done)
done()
).run()
```

But it not works very well, because mocha rewrites its `it` function on every 'pre-require' event and erases my 'sync' method.

But maybe there's another, better way to do it?

Thanks.