diff --git a/lib/jasmine-core/jasmine-html.js b/lib/jasmine-core/jasmine-html.js index f04d34a4..3f808bf6 100644 --- a/lib/jasmine-core/jasmine-html.js +++ b/lib/jasmine-core/jasmine-html.js @@ -167,7 +167,7 @@ jasmineRequire.HtmlReporter = function(j$) { this.resultStatus = function(status) { if(status === 'excluded') { - return config().hideDisabled ? 'jasmine-excluded-no-display' : 'jasmine-excluded'; + return config().hideDisabled ? 'jasmine-excluded-no-display' : 'jasmine-excluded'; } return 'jasmine-' + status; }; diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 1b86ef10..215b6b59 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -1721,7 +1721,7 @@ getJasmineRequireObj().Env = function(j$) { error: error && error.message ? error : null }); - if (self.throwingExpectationFailures()) { + if (config.oneFailurePerSpec) { throw new Error(message); } }; @@ -5108,26 +5108,29 @@ getJasmineRequireObj().QueueRunner = function(j$) { function once(fn) { var called = false; - return function() { + return function(arg) { if (!called) { called = true; - fn.apply(null, arguments); + // Direct call using single parameter, because cleanup/next does not need more + fn(arg); } return null; }; } + function emptyFn() {} + function QueueRunner(attrs) { var queueableFns = attrs.queueableFns || []; this.queueableFns = queueableFns.concat(attrs.cleanupFns || []); this.firstCleanupIx = queueableFns.length; - this.onComplete = attrs.onComplete || function() {}; + this.onComplete = attrs.onComplete || emptyFn; 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.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout}; - this.fail = attrs.fail || function() {}; - this.globalErrors = attrs.globalErrors || { pushListener: function() {}, popListener: function() {} }; + this.fail = attrs.fail || emptyFn; + this.globalErrors = attrs.globalErrors || { pushListener: emptyFn, popListener: emptyFn }; this.completeOnFirstError = !!attrs.completeOnFirstError; this.errored = false; @@ -5169,7 +5172,9 @@ getJasmineRequireObj().QueueRunner = function(j$) { next(error); }, cleanup = once(function cleanup() { - self.clearTimeout(timeoutId); + if (timeoutId !== void 0) { + self.clearTimeout(timeoutId); + } self.globalErrors.popListener(handleError); }), next = once(function next(err) { diff --git a/src/core/QueueRunner.js b/src/core/QueueRunner.js index d75c2988..a926cc91 100644 --- a/src/core/QueueRunner.js +++ b/src/core/QueueRunner.js @@ -5,26 +5,29 @@ getJasmineRequireObj().QueueRunner = function(j$) { function once(fn) { var called = false; - return function() { + return function(arg) { if (!called) { called = true; - fn.apply(null, arguments); + // Direct call using single parameter, because cleanup/next does not need more + fn(arg); } return null; }; } + function emptyFn() {} + function QueueRunner(attrs) { var queueableFns = attrs.queueableFns || []; this.queueableFns = queueableFns.concat(attrs.cleanupFns || []); this.firstCleanupIx = queueableFns.length; - this.onComplete = attrs.onComplete || function() {}; + this.onComplete = attrs.onComplete || emptyFn; 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.timeout = attrs.timeout || {setTimeout: setTimeout, clearTimeout: clearTimeout}; - this.fail = attrs.fail || function() {}; - this.globalErrors = attrs.globalErrors || { pushListener: function() {}, popListener: function() {} }; + this.fail = attrs.fail || emptyFn; + this.globalErrors = attrs.globalErrors || { pushListener: emptyFn, popListener: emptyFn }; this.completeOnFirstError = !!attrs.completeOnFirstError; this.errored = false; @@ -66,7 +69,9 @@ getJasmineRequireObj().QueueRunner = function(j$) { next(error); }, cleanup = once(function cleanup() { - self.clearTimeout(timeoutId); + if (timeoutId !== void 0) { + self.clearTimeout(timeoutId); + } self.globalErrors.popListener(handleError); }), next = once(function next(err) {