Skip to content

Commit 55a7a92

Browse files
author
cloudhead
committed
print contexts in dot-matrix & watch output
1 parent 06b5563 commit 55a7a92

File tree

3 files changed

+22
-17
lines changed

3 files changed

+22
-17
lines changed

lib/vows.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -106,13 +106,16 @@ function addVow(vow) {
106106
}
107107

108108
function output(status, exception) {
109+
var context;
110+
109111
if (exception || !vows.options.brief) {
110112
if (vow.context && batch.lastContext !== vow.context) {
111-
batch.lastContext = vow.context;
112-
batch.suite.report(['context', vow.context]);
113+
batch.lastContext = context = vow.context;
114+
batch.suite.report(['context', context]);
113115
}
114116
batch.suite.report(['vow', {
115117
title: vow.description,
118+
context: context,
116119
status: status,
117120
exception: exception || null
118121
}]);

lib/vows/reporters/dot-matrix.js

+15-13
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,21 @@ this.report = function (data, s) {
2525
case 'vow':
2626
if (event.status === 'honored') {
2727
sys.print(stylize('.', 'green'));
28-
} else if (event.status === 'broken') {
29-
sys.print(stylize('B', 'yellow'));
30-
messages.push(' - ' + stylize(event.title, 'yellow'));
31-
messages.push(' ~ ' + event.exception);
32-
messages.push('');
33-
} else if (event.status === 'errored') {
34-
sys.print(stylize('E', 'red'));
35-
messages.push(' - ' + stylize(event.title, 'red'));
36-
if (event.exception.type === 'promise') {
37-
messages.push(' * ' + stylize("An 'error' event was caught: " +
38-
stylize(event.exception.error, 'bold'), 'red'));
39-
} else {
40-
messages.push(' ! ' + stylize(event.exception, 'red'));
28+
} else {
29+
event.context && messages.push(event.context);
30+
if (event.status === 'broken') {
31+
sys.print(stylize('B', 'yellow'));
32+
messages.push(' - ' + stylize(event.title, 'yellow'));
33+
messages.push(' ~ ' + event.exception);
34+
} else if (event.status === 'errored') {
35+
sys.print(stylize('E', 'red'));
36+
messages.push(' - ' + stylize(event.title, 'red'));
37+
if (event.exception.type === 'promise') {
38+
messages.push(' * ' + stylize("An 'error' event was caught: " +
39+
stylize(event.exception.error, 'bold'), 'red'));
40+
} else {
41+
messages.push(' ! ' + stylize(event.exception, 'red'));
42+
}
4143
}
4244
messages.push('');
4345
}

lib/vows/reporters/watch.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ this.report = function (data) {
1616
switch (data[0]) {
1717
case 'vow':
1818
if (event.status !== 'honored') {
19+
event.context && puts(event.context);
1920
if (event.status === 'broken') {
2021
puts(' - ' + stylize(event.title, 'yellow'));
2122
puts(' ~ ' + event.exception);
22-
puts('');
2323
} else if (event.status === 'errored') {
2424
puts(' - ' + stylize(event.title, 'red'));
2525
if (event.exception.type === 'promise') {
@@ -28,8 +28,8 @@ this.report = function (data) {
2828
} else {
2929
puts(' ! ' + stylize(event.exception, 'red'));
3030
}
31-
puts('');
3231
}
32+
puts('');
3333
}
3434
break;
3535
case 'error':

0 commit comments

Comments
 (0)