Merge branch 'master' of https://github.com/Havunen/jasmine into Havunen-master

- Merges #1599 from @Havunen
This commit is contained in:
Gregg Van Hove
2018-09-25 17:13:32 -07:00
3 changed files with 26 additions and 16 deletions
+1 -1
View File
@@ -167,7 +167,7 @@ jasmineRequire.HtmlReporter = function(j$) {
this.resultStatus = function(status) { this.resultStatus = function(status) {
if(status === 'excluded') { if(status === 'excluded') {
return config().hideDisabled ? 'jasmine-excluded-no-display' : 'jasmine-excluded'; return config().hideDisabled ? 'jasmine-excluded-no-display' : 'jasmine-excluded';
} }
return 'jasmine-' + status; return 'jasmine-' + status;
}; };
+13 -8
View File
@@ -1721,7 +1721,7 @@ getJasmineRequireObj().Env = function(j$) {
error: error && error.message ? error : null error: error && error.message ? error : null
}); });
if (self.throwingExpectationFailures()) { if (config.oneFailurePerSpec) {
throw new Error(message); throw new Error(message);
} }
}; };
@@ -5108,26 +5108,29 @@ getJasmineRequireObj().QueueRunner = function(j$) {
function once(fn) { function once(fn) {
var called = false; var called = false;
return function() { return function(arg) {
if (!called) { if (!called) {
called = true; called = true;
fn.apply(null, arguments); // Direct call using single parameter, because cleanup/next does not need more
fn(arg);
} }
return null; return null;
}; };
} }
function emptyFn() {}
function QueueRunner(attrs) { function QueueRunner(attrs) {
var queueableFns = attrs.queueableFns || []; var queueableFns = attrs.queueableFns || [];
this.queueableFns = queueableFns.concat(attrs.cleanupFns || []); this.queueableFns = queueableFns.concat(attrs.cleanupFns || []);
this.firstCleanupIx = queueableFns.length; this.firstCleanupIx = queueableFns.length;
this.onComplete = attrs.onComplete || function() {}; this.onComplete = attrs.onComplete || emptyFn;
this.clearStack = attrs.clearStack || function(fn) {fn();}; this.clearStack = attrs.clearStack || function(fn) {fn();};
this.onException = attrs.onException || function() {}; this.onException = attrs.onException || emptyFn;
this.userContext = attrs.userContext || new j$.UserContext(); this.userContext = attrs.userContext || new j$.UserContext();
this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout}; this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
this.fail = attrs.fail || function() {}; this.fail = attrs.fail || emptyFn;
this.globalErrors = attrs.globalErrors || { pushListener: function() {}, popListener: function() {} }; this.globalErrors = attrs.globalErrors || { pushListener: emptyFn, popListener: emptyFn };
this.completeOnFirstError = !!attrs.completeOnFirstError; this.completeOnFirstError = !!attrs.completeOnFirstError;
this.errored = false; this.errored = false;
@@ -5169,7 +5172,9 @@ getJasmineRequireObj().QueueRunner = function(j$) {
next(error); next(error);
}, },
cleanup = once(function cleanup() { cleanup = once(function cleanup() {
self.clearTimeout(timeoutId); if (timeoutId !== void 0) {
self.clearTimeout(timeoutId);
}
self.globalErrors.popListener(handleError); self.globalErrors.popListener(handleError);
}), }),
next = once(function next(err) { next = once(function next(err) {
+12 -7
View File
@@ -5,26 +5,29 @@ getJasmineRequireObj().QueueRunner = function(j$) {
function once(fn) { function once(fn) {
var called = false; var called = false;
return function() { return function(arg) {
if (!called) { if (!called) {
called = true; called = true;
fn.apply(null, arguments); // Direct call using single parameter, because cleanup/next does not need more
fn(arg);
} }
return null; return null;
}; };
} }
function emptyFn() {}
function QueueRunner(attrs) { function QueueRunner(attrs) {
var queueableFns = attrs.queueableFns || []; var queueableFns = attrs.queueableFns || [];
this.queueableFns = queueableFns.concat(attrs.cleanupFns || []); this.queueableFns = queueableFns.concat(attrs.cleanupFns || []);
this.firstCleanupIx = queueableFns.length; this.firstCleanupIx = queueableFns.length;
this.onComplete = attrs.onComplete || function() {}; this.onComplete = attrs.onComplete || emptyFn;
this.clearStack = attrs.clearStack || function(fn) {fn();}; this.clearStack = attrs.clearStack || function(fn) {fn();};
this.onException = attrs.onException || function() {}; this.onException = attrs.onException || emptyFn;
this.userContext = attrs.userContext || new j$.UserContext(); this.userContext = attrs.userContext || new j$.UserContext();
this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout}; this.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout};
this.fail = attrs.fail || function() {}; this.fail = attrs.fail || emptyFn;
this.globalErrors = attrs.globalErrors || { pushListener: function() {}, popListener: function() {} }; this.globalErrors = attrs.globalErrors || { pushListener: emptyFn, popListener: emptyFn };
this.completeOnFirstError = !!attrs.completeOnFirstError; this.completeOnFirstError = !!attrs.completeOnFirstError;
this.errored = false; this.errored = false;
@@ -66,7 +69,9 @@ getJasmineRequireObj().QueueRunner = function(j$) {
next(error); next(error);
}, },
cleanup = once(function cleanup() { cleanup = once(function cleanup() {
self.clearTimeout(timeoutId); if (timeoutId !== void 0) {
self.clearTimeout(timeoutId);
}
self.globalErrors.popListener(handleError); self.globalErrors.popListener(handleError);
}), }),
next = once(function next(err) { next = once(function next(err) {