Collect unhandled exceptions and pass them to the current runnable

Fixes #529
Fixes #937
This commit is contained in:
Gregg Van Hove
2017-03-07 16:32:11 -08:00
parent 92e7436db2
commit 1042c9a2dd
8 changed files with 283 additions and 0 deletions

View File

@@ -40,6 +40,8 @@ getJasmineRequireObj().Env = function(j$) {
'specDone'
]);
var globalErrors = new j$.GlobalErrors();
this.specFilter = function() {
return true;
};
@@ -187,6 +189,7 @@ getJasmineRequireObj().Env = function(j$) {
options.clearStack = options.clearStack || clearStack;
options.timeout = {setTimeout: realSetTimeout, clearTimeout: realClearTimeout};
options.fail = self.fail;
options.globalErrors = globalErrors;
new j$.QueueRunner(options).execute();
};
@@ -250,9 +253,11 @@ getJasmineRequireObj().Env = function(j$) {
currentlyExecutingSuites.push(topSuite);
globalErrors.install();
processor.execute(function() {
clearResourcesForRunnable(topSuite.id);
currentlyExecutingSuites.pop();
globalErrors.uninstall();
reporter.jasmineDone({
order: order,