Skip to content

Commit acbb20a

Browse files
committed
[fix] Partially revert bc4c239. Fixes #325.
1 parent 2405195 commit acbb20a

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

lib/vows.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
//
1818
var path = require('path'),
1919
events = require('events'),
20+
util = require('util'),
2021
vows = exports;
2122

2223
// Options
@@ -122,7 +123,7 @@ function addVow(vow) {
122123
var after = vow.binding.context.after;
123124
// only need to check order. I won't get here if the after event
124125
// has never been emitted
125-
if (self._vowsEmitedEventsOrder.indexOf(after) >
126+
if (self._vowsEmitedEventsOrder.indexOf(after) >
126127
self._vowsEmitedEventsOrder.indexOf(event)) {
127128
output('broken', event + ' emitted before ' + after);
128129
return;
@@ -184,7 +185,7 @@ process.on('exit', function () {
184185
}
185186
});
186187

187-
if (unFired.length > 0) { console.log(); }
188+
if (unFired.length > 0) { util.print('\n'); }
188189

189190
unFired.forEach(function (title) {
190191
s.reporter.report(['error', {
@@ -204,7 +205,7 @@ process.on('exit', function () {
204205
});
205206
});
206207
if (failure) {
207-
console.log(console.result(results));
208+
util.puts(console.result(results));
208209
process.exit(1);
209210
}
210211
});

lib/vows/console.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ this.stylize = function stylize(str, style) {
55
if (module.exports.nocolor) {
66
return str;
77
}
8-
8+
99
var styles = {
1010
'bold' : [1, 22],
1111
'italic' : [3, 23],
@@ -52,6 +52,8 @@ this.puts = function (options) {
5252
};
5353
};
5454

55+
this.log = this.puts({});
56+
5557
this.result = function (event) {
5658
var result = [], buffer = [], time = '', header;
5759
var complete = event.honored + event.pending + event.errored + event.broken;
@@ -93,7 +95,7 @@ this.inspect = function inspect(val) {
9395
if (module.exports.nocolor) {
9496
return eyes(val);
9597
}
96-
98+
9799
return '\033[1m' + eyes(val) + '\033[22m';
98100
};
99101

lib/vows/reporters/spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ this.report = function (data) {
2626
puts(console.vowText(event));
2727
break;
2828
case 'end':
29-
console.log();
29+
this.print('\n');
3030
break;
3131
case 'finish':
3232
puts(console.result(event).join('\n'));

test/experimental/gh-325.js

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
var vows = require('./'),
2+
assert = require('assert');
3+
4+
vows.describe('basic-formulation').addBatch({
5+
"An invocation with no query string": {
6+
topic: function() {
7+
request.get("http://localhost:8080/something", this.callback);
8+
},
9+
10+
"does not fail": function(error, response, body) {
11+
assert.notEqual(true, error);
12+
},
13+
14+
"receives a response": {
15+
"with status 200": function(error, response, body) {
16+
assert.equal(200, response.statusCode);
17+
}
18+
}
19+
}
20+
}).export(module);

0 commit comments

Comments
 (0)