Skip to content

Commit

Permalink
More GUI updates. Moved result summary to single line. Made passed re…
Browse files Browse the repository at this point in the history
…sults bold and green, made failed results bold and red. Also cleaned up the returned message from a failed suite. Failed suite messages are grouped and the error message is formatted better. Example here: https://gist.github.com/ee995826dfd139bd6cd0
  • Loading branch information
davglass authored and reid committed Sep 29, 2010
1 parent deca2a1 commit 326fc70
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions lib/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,25 @@ function results (result, verbose) {

var browser = Browser.forAgent(result.ua);

if (result.ua !== browser) {
//browser += " (" + result.ua + ")";
}

var icon = result.failed ? exports.bad : exports.good;
var em = result.failed ? color.red : color.green;
var fa = result.failed ? color.red : function(str) { return str; };
log(em(icon) + " " + color.bold(result.name) + " on " + browser);
log(" (" + result.ua + ")");
log(" " + result.passed + " passed");
log(" " + result.failed + " failed");

var str = ' ' + result.passed + ' passed',
str2 = ' ' + result.failed + ' failed';

if (result.passed) {
str = color.bold(color.green(str));
}
if (result.failed) {
str2 = color.bold(color.red(str2));
}
log(str + ', ' + str2);

if (result.failed) {
var lastSuite;
for (var k in result) {
var suite = result[k];
if ("object" === typeof suite) {
Expand All @@ -86,8 +93,15 @@ function results (result, verbose) {
var test = suite[k1];
if ("object" === typeof test) {
if ("fail" === test.result) {
log(" in", color.bold(suite.name));
log(" ", color.bold(color.red(test.name)), test.message);
if (!lastSuite || lastSuite !== suite.name) {
log(" in", color.bold(suite.name));
lastSuite = suite.name;
}
var msg = test.message.split('\n');
log(" ", color.bold(color.red(test.name)), msg[0]);
for (var m = 1; m < msg.length; m++) {
log(" " + msg[m]);
}
}
}
}
Expand Down

0 comments on commit 326fc70

Please sign in to comment.