dwf/rva: rolled back blank expectations for now; Now catching exceptions & reporting them in results.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user