diff --git a/grunt/tasks/spec.js b/grunt/tasks/spec.js index 40839408..2d9c6195 100644 --- a/grunt/tasks/spec.js +++ b/grunt/tasks/spec.js @@ -3,8 +3,9 @@ var grunt = require('grunt'); module.exports = { execSpecsInNode: function() { - if (shell.exec("node spec/node_suite.js --color=true").code !== 0) { - grunt.fail.fatal("Specs Failed"); + var exit_code = shell.exec("node spec/node_suite.js --color=true").code; + if (exit_code !== 0) { + grunt.fail.fatal("Specs Failed", exit_code); } } }; diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index d2e2defd..5610f0e0 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -278,13 +278,13 @@ getJasmineRequireObj().Spec = function() { function timeoutable(fn) { return function(done) { - var timeout = Function.prototype.apply.apply(self.timer.setTimeout, [window, [function() { + var timeout = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() { onException(new Error('timeout')); done(); }, 10000]]); var callDone = function() { - Function.prototype.apply.apply(self.timer.clearTimeout, [window, [timeout]]); + Function.prototype.apply.apply(self.timer.clearTimeout, [j$.getGlobal(), [timeout]]); done(); }; @@ -477,7 +477,7 @@ getJasmineRequireObj().Env = function(j$) { return j$.Spec.isPendingSpecException(e) || catchExceptions; }; - var maximumSpecCallbackDepth = 100; + var maximumSpecCallbackDepth = 75; var currentSpecCallbackDepth = 0; function clearStack(fn) { diff --git a/spec/core/ExceptionFormatterSpec.js b/spec/core/ExceptionFormatterSpec.js index 2366c353..88d83938 100644 --- a/spec/core/ExceptionFormatterSpec.js +++ b/spec/core/ExceptionFormatterSpec.js @@ -41,7 +41,7 @@ describe("ExceptionFormatter", function() { describe("#stack", function() { it("formats stack traces from Webkit, Firefox, node.js or IE10+", function() { - if (jasmine.getEnv().ieVersion < 10) { return; } + if (jasmine.getEnv().ieVersion < 10 || jasmine.getEnv().safariVersion < 6) { return; } var error; try { throw new Error("an error") } catch(e) { error = e; } diff --git a/spec/helpers/BrowserFlags.js b/spec/helpers/BrowserFlags.js index d6463e1c..fdd80dc4 100644 --- a/spec/helpers/BrowserFlags.js +++ b/spec/helpers/BrowserFlags.js @@ -7,4 +7,13 @@ return match ? parseFloat(match[1]) : Number.MAX_VALUE; })(); + + env.safariVersion = (function() { + var userAgent = jasmine.getGlobal().navigator.userAgent; + if (!userAgent) { return Number.MAX_VALUE; } + + var match = /Safari/.exec(userAgent) && /Version\/([0-9]{0,})/.exec(userAgent); + + return match ? parseFloat(match[1]) : Number.MAX_VALUE; + })(); })(jasmine.getEnv()); diff --git a/src/console/ConsoleReporter.js b/src/console/ConsoleReporter.js index bd04d7d9..e26720d5 100644 --- a/src/console/ConsoleReporter.js +++ b/src/console/ConsoleReporter.js @@ -52,7 +52,7 @@ getJasmineRequireObj().ConsoleReporter = function() { printNewline(); - onComplete(); + onComplete(failureCount === 0); }; this.specDone = function(result) { diff --git a/src/console/console.js b/src/console/console.js index 67121233..0a08f089 100644 --- a/src/console/console.js +++ b/src/console/console.js @@ -87,7 +87,7 @@ getJasmineRequireObj().ConsoleReporter = function() { printNewline(); - onComplete(); + onComplete(failureCount === 0); }; this.specDone = function(result) { diff --git a/src/core/Env.js b/src/core/Env.js index 20436edc..868b1c9a 100644 --- a/src/core/Env.js +++ b/src/core/Env.js @@ -106,7 +106,7 @@ getJasmineRequireObj().Env = function(j$) { return j$.Spec.isPendingSpecException(e) || catchExceptions; }; - var maximumSpecCallbackDepth = 100; + var maximumSpecCallbackDepth = 75; var currentSpecCallbackDepth = 0; function clearStack(fn) { diff --git a/src/core/Spec.js b/src/core/Spec.js index 27b11087..1701319b 100644 --- a/src/core/Spec.js +++ b/src/core/Spec.js @@ -55,13 +55,13 @@ getJasmineRequireObj().Spec = function() { function timeoutable(fn) { return function(done) { - var timeout = Function.prototype.apply.apply(self.timer.setTimeout, [window, [function() { + var timeout = Function.prototype.apply.apply(self.timer.setTimeout, [j$.getGlobal(), [function() { onException(new Error('timeout')); done(); }, 10000]]); var callDone = function() { - Function.prototype.apply.apply(self.timer.clearTimeout, [window, [timeout]]); + Function.prototype.apply.apply(self.timer.clearTimeout, [j$.getGlobal(), [timeout]]); done(); };