dwf/rva: rolled back blank expectations for now; Now catching exceptions & reporting them in results.

This commit is contained in:
pivotal
2008-12-10 11:20:33 -08:00
parent c9edbbe9b7
commit 259390868e
3 changed files with 115 additions and 36 deletions

View File

@@ -237,9 +237,26 @@ var it = function (description, func) {
that.finished = true;
},
safeExecute: function(queuedFunc) {
try {
queuedFunc.execute();
}
catch (e) {
that.results.push({
passed: false,
message: e.name + ': '+ e.message + ' in ' + e.fileName +
' (line ' + e.lineNumber +')'
});
queuedFunc.next();
}
},
execute: function () {
if (that.queue[0]) {
that.queue[0].execute();
that.safeExecute(that.queue[0])
}
else {
that.finish();
}
}
};
@@ -251,7 +268,7 @@ var it = function (description, func) {
if (that.queue.length > 1) {
var previousFunction = that.queue[that.queue.length - 2];
previousFunction.next = function () {
currentFunction.execute();
that.safeExecute(currentFunction);
}
}
@@ -343,12 +360,20 @@ Jasmine.Reporters.reporter = function (callbacks) {
callbacks: callbacks || {},
doCallback: function (callback, results) {
if (callback) { callback(results); }
if (callback) {
callback(results);
}
},
reportRunnerResults: function (results) { that.doCallback(that.callbacks.runnerCallback, results); },
reportSuiteResults: function (results) { that.doCallback(that.callbacks.suiteCallback, results); },
reportSpecResults: function (results) { that.doCallback(that.callbacks.specCallback, results);}
reportRunnerResults: function (results) {
that.doCallback(that.callbacks.runnerCallback, results);
},
reportSuiteResults: function (results) {
that.doCallback(that.callbacks.suiteCallback, results);
},
reportSpecResults: function (results) {
that.doCallback(that.callbacks.specCallback, results);
}
}
return that;