Skip to content

Commit a604161

Browse files
author
cloudhead
committed
renamed 'printer' -> 'reporter'
1 parent dc9a746 commit a604161

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

lib/vows.js

+11-15
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ vows.options = {
2828
brief: false,
2929
json: false,
3030
matcher: /.*/,
31-
printer: require('vows/printers/console')
31+
reporter: require('vows/reporters/console')
3232
};
3333

34-
vows.__defineGetter__('printer', function () {
35-
return vows.options.printer;
34+
vows.__defineGetter__('reporter', function () {
35+
return vows.options.reporter;
3636
});
3737

38-
var stylize = require('vows/printers/console').stylize;
38+
var stylize = require('vows/reporters/console').stylize;
3939

4040
// Keeps track of the outcome of vows.
4141
var total = 0, honored = 0,
@@ -178,9 +178,9 @@ function addVow(/* description & callback */) {
178178
if (exception || !vows.options.brief) {
179179
if (vow.context && lastContext !== vow.context) {
180180
lastContext = vow.context;
181-
vows.printer.print(['context', vow.context]);
181+
vows.reporter.report(['context', vow.context]);
182182
}
183-
vows.printer.print(['vow', {
183+
vows.reporter.report(['vow', {
184184
title: vow.description,
185185
status: status,
186186
exception: exception || null
@@ -342,19 +342,15 @@ function tryFinish(remaining, promise) {
342342
// If this isn't the last test suite in the chain,
343343
// emit 'end', to trigger the next test suite.
344344
if (promise && promise.listeners('end').length > 0) {
345-
if (vows.options.json) {
346-
puts(['end']);
347-
} else {
348-
sys.print('\n');
349-
}
345+
vows.reporter.report(['end']);
350346
promise.emit('end', honored, broken, errored);
351347
} else {
352348
time = (new(Date) - start) / 1000;
353349
// The 'finish' event is triggered once all the tests have been run.
354350
// It's used by bin/vows
355351
vows.promises[suites - 1].emit("finish", honored, broken, errored);
356352

357-
vows.printer.print([ 'finish', {
353+
vows.reporter.report([ 'finish', {
358354
honored: honored,
359355
broken: broken,
360356
errored: errored,
@@ -373,11 +369,11 @@ function tryFinish(remaining, promise) {
373369

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

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

425421
if (!vows.options.brief) {
426-
this.printer.print(['subject', subject]);
422+
this.reporter.report(['subject', subject]);
427423
}
428424

429425
return new(events.EventEmitter)().addListener('newListener', function (e, listener) {

lib/vows/printers/console.js renamed to lib/vows/reporters/console.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
var sys = require('sys');
22
//
3-
// Console printer
3+
// Console reporter
44
//
5-
this.print = function (data) {
5+
this.report = function (data) {
66
var event = data[1];
77

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

0 commit comments

Comments
 (0)