Skip to content

Commit

Permalink
renamed 'printer' -> 'reporter'
Browse files Browse the repository at this point in the history
  • Loading branch information
cloudhead committed May 17, 2010
1 parent dc9a746 commit a604161
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 17 deletions.
26 changes: 11 additions & 15 deletions lib/vows.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ vows.options = {
brief: false,
json: false,
matcher: /.*/,
printer: require('vows/printers/console')
reporter: require('vows/reporters/console')
};

vows.__defineGetter__('printer', function () {
return vows.options.printer;
vows.__defineGetter__('reporter', function () {
return vows.options.reporter;
});

var stylize = require('vows/printers/console').stylize;
var stylize = require('vows/reporters/console').stylize;

// Keeps track of the outcome of vows.
var total = 0, honored = 0,
Expand Down Expand Up @@ -178,9 +178,9 @@ function addVow(/* description & callback */) {
if (exception || !vows.options.brief) {
if (vow.context && lastContext !== vow.context) {
lastContext = vow.context;
vows.printer.print(['context', vow.context]);
vows.reporter.report(['context', vow.context]);
}
vows.printer.print(['vow', {
vows.reporter.report(['vow', {
title: vow.description,
status: status,
exception: exception || null
Expand Down Expand Up @@ -342,19 +342,15 @@ function tryFinish(remaining, promise) {
// If this isn't the last test suite in the chain,
// emit 'end', to trigger the next test suite.
if (promise && promise.listeners('end').length > 0) {
if (vows.options.json) {
puts(['end']);
} else {
sys.print('\n');
}
vows.reporter.report(['end']);
promise.emit('end', honored, broken, errored);
} else {
time = (new(Date) - start) / 1000;
// The 'finish' event is triggered once all the tests have been run.
// It's used by bin/vows
vows.promises[suites - 1].emit("finish", honored, broken, errored);

vows.printer.print([ 'finish', {
vows.reporter.report([ 'finish', {
honored: honored,
broken: broken,
errored: errored,
Expand All @@ -373,11 +369,11 @@ function tryFinish(remaining, promise) {

//
// On exit, check that all promises have been fired.
// If not, print an error message.
// If not, report an error message.
//
process.addListener('exit', function () {
if (honored + broken + errored < total) {
vows.printer.print(['error', { error: "An EventEmitter has failed to fire.", type: 'promise' }]);
vows.reporter.report(['error', { error: "An EventEmitter has failed to fire.", type: 'promise' }]);
}
});

Expand Down Expand Up @@ -423,7 +419,7 @@ vows.describe = function (subject) {
buffer = [], suites = 0;

if (!vows.options.brief) {
this.printer.print(['subject', subject]);
this.reporter.report(['subject', subject]);
}

return new(events.EventEmitter)().addListener('newListener', function (e, listener) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
var sys = require('sys');
//
// Console printer
// Console reporter
//
this.print = function (data) {
this.report = function (data) {
var event = data[1];

switch (data[0]) {
Expand Down
File renamed without changes.

0 comments on commit a604161

Please sign in to comment.