Skip to content

Commit

Permalink
test runner: output fileName&lineNo for new Error() exception
Browse files Browse the repository at this point in the history
also: fixes a bug when a custom exception is thrown. In this case
we try to extract the message with toString() on the custom exception
  • Loading branch information
oberhamsi committed Feb 5, 2014
1 parent 0d52fbc commit c82ea95
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ TermWriter.prototype.writeTestFailed = function(exception) {
exception.stackTrace.forEach(function(line) {
term.writeln(" ", term.BOLD, line);
});
} else if (exception.fileName) {
term.writeln(" at " + exception.fileName + ":" + exception.lineNumber);
}
term.writeln("");
return;
Expand Down Expand Up @@ -394,6 +396,8 @@ function EvaluationError(messageOrException) {
*/
if (messageOrException instanceof Error) {
exception = messageOrException;
} else if (typeof(messageOrException.toString) === 'function') {
message = messageOrException.toString();
} else {
message = messageOrException;
}
Expand Down

0 comments on commit c82ea95

Please sign in to comment.