diff --git a/lib/console/console.js b/lib/console/console.js index 0a08f089..33c1698c 100644 --- a/lib/console/console.js +++ b/lib/console/console.js @@ -50,10 +50,10 @@ getJasmineRequireObj().ConsoleReporter = function() { failedSpecs = [], pendingCount, ansi = { - green: '\033[32m', - red: '\033[31m', - yellow: '\033[33m', - none: '\033[0m' + green: '\x1B[32m', + red: '\x1B[31m', + yellow: '\x1B[33m', + none: '\x1B[0m' }; this.jasmineStarted = function() { diff --git a/lib/jasmine-core/jasmine.js b/lib/jasmine-core/jasmine.js index 7e0bf0a5..171890a3 100644 --- a/lib/jasmine-core/jasmine.js +++ b/lib/jasmine-core/jasmine.js @@ -97,13 +97,12 @@ getJasmineRequireObj().base = function(j$) { j$.MAX_PRETTY_PRINT_DEPTH = 40; j$.DEFAULT_TIMEOUT_INTERVAL = 5000; - j$.getGlobal = function() { - function getGlobal() { - return this; - } - - return getGlobal(); - }; + j$.getGlobal = (function() { + var jasmineGlobal = eval.call(null, "this"); + return function() { + return jasmineGlobal; + }; + })(); j$.getEnv = function(options) { var env = j$.currentEnv_ = j$.currentEnv_ || new j$.Env(options); @@ -238,7 +237,7 @@ getJasmineRequireObj().Spec = function(j$) { this.exceptionFormatter = attrs.exceptionFormatter || function() {}; this.getSpecName = attrs.getSpecName || function() { return ''; }; this.expectationResultFactory = attrs.expectationResultFactory || function() { }; - this.queueRunner = attrs.queueRunner || function() {}; + this.queueRunnerFactory = attrs.queueRunnerFactory || function() {}; this.catchingExceptions = attrs.catchingExceptions || function() { return true; }; this.timer = attrs.timer || {setTimeout: setTimeout, clearTimeout: clearTimeout}; @@ -288,7 +287,13 @@ getJasmineRequireObj().Spec = function(j$) { done(); }; - fn.call(this, callDone); //TODO: do we care about more than 1 arg? + try { + fn.call(this, callDone); //TODO: do we care about more than 1 arg? + } + catch (e) { + onException(e); + callDone(); + } }; } @@ -297,7 +302,7 @@ getJasmineRequireObj().Spec = function(j$) { thisOne = (this.fn.length) ? timeoutable(this.fn) : this.fn; var allFns = befores.concat(thisOne).concat(afters); - this.queueRunner({ + this.queueRunnerFactory({ fns: allFns, onException: onException, onComplete: complete @@ -641,7 +646,7 @@ getJasmineRequireObj().Env = function(j$) { onStart: specStarted, description: description, expectationResultFactory: expectationResultFactory, - queueRunner: queueRunnerFactory, + queueRunnerFactory: queueRunnerFactory, fn: fn, timer: {setTimeout: realSetTimeout, clearTimeout: realClearTimeout} });