Skip to content

Commit

Permalink
improved emitter code in describe()
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed May 11, 2010
1 parent 8a4f76d commit 99eb7de
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/vows.js
Original file line number Diff line number Diff line change
Expand Up @@ -370,17 +370,18 @@ vows.describe = function (subject) {
broken = 0, errored = 0;
buffer = [], suites = 0;

var promise = new(events.EventEmitter);

process.nextTick(function () {
if (!vows.options.brief) {
puts('\n' + stylize(subject, 'underline') + '\n');
}
promise.emit("end");
});
start = new(Date);

return promise;
return new(events.EventEmitter)().addListener('newListener', function (e, listener) {
if (e === 'end') {
this.removeListener(e, listener);
start = new(Date);
listener.call(this);
}
});
};

vows.tell = vows.describe;
Expand Down

0 comments on commit 99eb7de

Please sign in to comment.