Skip to content

Commit

Permalink
use 'on' instead of 'addListener'
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed Jan 29, 2011
1 parent eb4d50d commit 4361e42
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions lib/vows.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var Suite = require('vows/suite').Suite;

//
// This function gets added to events.EventEmitter.prototype, by default.
// It's essentially a wrapper around `addListener`, which adds all the specification
// It's essentially a wrapper around `on`, which adds all the specification
// goodness.
//
function addVow(vow) {
Expand All @@ -63,7 +63,7 @@ function addVow(vow) {
batch.total ++;
batch.vows.push(vow);

return this.addListener("success", function () {
return this.on("success", function () {
var args = Array.prototype.slice.call(arguments);
// If the callback is expecting two or more arguments,
// pass the error as the first (null) and the result after.
Expand All @@ -73,7 +73,7 @@ function addVow(vow) {
runTest(args);
vows.tryEnd(batch);

}).addListener("error", function (err) {
}).on("error", function (err) {
if (vow.callback.length >= 2 || !batch.suite.options.error) {
runTest([err]);
} else {
Expand Down Expand Up @@ -124,7 +124,7 @@ function addVow(vow) {
// On exit, check that all promises have been fired.
// If not, report an error message.
//
process.addListener('exit', function () {
process.on('exit', function () {
var results = { honored: 0, broken: 0, errored: 0, pending: 0, total: 0 }, failure;

vows.suites.forEach(function (s) {
Expand Down
8 changes: 4 additions & 4 deletions lib/vows/suite.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ this.Suite.prototype = new(function () {
topic = ctx.emitter;
}

topic.addListener('success', function (val) {
topic.on('success', function (val) {
// Once the topic fires, add the return value
// to the beginning of the topics list, so it
// becomes the first argument for the next topic.
Expand Down Expand Up @@ -196,7 +196,7 @@ this.Suite.prototype = new(function () {
// before calling the inner context. Else, just run the inner context
// synchronously.
if (topic) {
topic.addListener("success", function (ctx) {
topic.on("success", function (ctx) {
return function (val) {
return run(new(Context)(vow, ctx, env), lastTopic);
};
Expand All @@ -207,7 +207,7 @@ this.Suite.prototype = new(function () {
}
});
// Teardown
topic.addListener("success", function () {
topic.on("success", function () {
if (ctx.tests.teardown) {
ctx.tests.teardown.apply(ctx.env, ctx.topics);
}
Expand Down Expand Up @@ -257,7 +257,7 @@ this.Suite.prototype = new(function () {
if (batch.remaining === 0) {
run(batches);
} else {
that.runBatch(batch).addListener('end', function () {
that.runBatch(batch).on('end', function () {
run(batches);
});
}
Expand Down

0 comments on commit 4361e42

Please sign in to comment.