Permalink
Browse files

highlight runtimes with color

highlight runtimes with color
different colors for suite times vs. test times
  • Loading branch information...
1 parent ca77031 commit 49eb9d3694d1183b02117c0e2c129fdb277ec2c4 @rick-kilgore rick-kilgore committed Jan 18, 2014
Showing with 10 additions and 4 deletions.
  1. +10 −4 lib/jasmine-node/reporter.js
@@ -47,13 +47,17 @@
ANSIColors: {
pass: function() { return '\033[32m'; }, // Green
fail: function() { return '\033[31m'; }, // Red
+ specTiming: function() { return '\033[34m'; }, // Blue
+ suiteTiming: function() { return '\033[33m'; }, // Yelow
ignore: function() { return '\033[37m'; }, // Light Gray
neutral: function() { return '\033[0m'; } // Normal
},
NoColors: {
pass: function() { return ''; },
fail: function() { return ''; },
+ specTiming: function() { return ''; },
+ suiteTiming: function() { return ''; },
ignore: function() { return ''; },
neutral: function() { return ''; }
},
@@ -279,24 +283,26 @@
if (element.type === 'spec') {
specResult = this.specResults_[element.id.toString()];
- element.name = element.name + " - " + specResult.runtime + " ms"
if (specResult.result === 'passed') {
msg = this.stringWithColor_(this.indentMessage_(element.name, depth), this.color_.pass());
} else {
msg = this.stringWithColor_(this.indentMessage_(element.name, depth), this.color_.fail());
}
+ msg += this.stringWithColor_(" - " + specResult.runtime + " ms",
+ this.color_.specTiming());
messages.push(msg);
} else {
+ messages.push('');
+ msg = this.indentMessage_(element.name, depth)
if (element.id != null) {
suiteResult = this.suiteResults_[element.id.toString()];
if (suiteResult) {
- element.name = element.name + " - " + suiteResult.runtime + " ms";
+ msg += this.stringWithColor_(" - " + suiteResult.runtime + " ms", this.color_.suiteTiming());
}
}
- messages.push('');
- messages.push(this.indentMessage_(element.name, depth));
+ messages.push(msg);
}
this.buildMessagesFromResults_(messages, element.children, depth + 2);

0 comments on commit 49eb9d3

Please sign in to comment.