Separate clear stack and run it after each spec

[finishes #50197985][fix #109418332]
- Fixes #985
- Fixes #945
- Fixes #366
This commit is contained in:
Gregg Van Hove
2016-10-14 09:21:49 -07:00
parent d85d6dd4b8
commit 17c89c69d6
7 changed files with 125 additions and 25 deletions

View File

@@ -11,6 +11,7 @@ getJasmineRequireObj().Env = function(j$) {
var realSetTimeout = j$.getGlobal().setTimeout;
var realClearTimeout = j$.getGlobal().clearTimeout;
var clearStack = j$.getClearStack(j$.getGlobal());
this.clock = new j$.Clock(global, function () { return new j$.DelayedFunctionScheduler(); }, new j$.MockDate(global));
var runnableResources = {};
@@ -154,16 +155,6 @@ getJasmineRequireObj().Env = function(j$) {
var maximumSpecCallbackDepth = 20;
var currentSpecCallbackDepth = 0;
function clearStack(fn) {
currentSpecCallbackDepth++;
if (currentSpecCallbackDepth >= maximumSpecCallbackDepth) {
currentSpecCallbackDepth = 0;
realSetTimeout(fn, 0);
} else {
fn();
}
}
var catchException = function(e) {
return j$.Spec.isPendingSpecException(e) || catchExceptions;
};