diff --git a/lib/jasmine/headless/files_list.rb b/lib/jasmine/headless/files_list.rb index 0e26f50..eef115a 100644 --- a/lib/jasmine/headless/files_list.rb +++ b/lib/jasmine/headless/files_list.rb @@ -72,6 +72,7 @@ module Jasmine::Headless def default_files %w{jasmine.js jasmine-html jasmine.css jasmine-extensions intense headless_reporter_result jasmine.HeadlessReporter + jasmine.HeadlessReporter.ConsoleBase jsDump beautify-html} end diff --git a/spec/javascripts/jasmine.HeadlessReporter.ConsoleBase_spec.coffee b/spec/javascripts/jasmine.HeadlessReporter.ConsoleBase_spec.coffee new file mode 100644 index 0000000..ed865be --- /dev/null +++ b/spec/javascripts/jasmine.HeadlessReporter.ConsoleBase_spec.coffee @@ -0,0 +1,35 @@ +describe 'jasmine.HeadlessReporter.ConsoleBase', -> + reporter = null + + beforeEach -> + reporter = new jasmine.HeadlessReporter.ConsoleBase() + + describe '#formatResultLine', -> + context 'length = 1', -> + it 'should format', -> + reporter.length = 1 + expect(reporter.formatResultLine(0)).toMatch(/test,/) + + context 'length != 1', -> + it 'should format', -> + reporter.length = 2 + expect(reporter.formatResultLine(0)).toMatch(/tests,/) + + context 'failedCount = 1', -> + it 'should format', -> + reporter.failedCount = 1 + expect(reporter.formatResultLine(0)).toMatch(/failure,/) + + context 'failedCount != 1', -> + it 'should format', -> + reporter.failedCount = 0 + expect(reporter.formatResultLine(0)).toMatch(/failures,/) + + context 'runtime = 1', -> + it 'should format', -> + expect(reporter.formatResultLine(1)).toMatch(/sec./) + + context 'runtime != 1', -> + it 'should format', -> + expect(reporter.formatResultLine(0)).toMatch(/secs./) + diff --git a/spec/javascripts/jasmine.HeadlessReporter.Console_spec.coffee b/spec/javascripts/jasmine.HeadlessReporter.Console_spec.coffee index 767609c..fa564be 100644 --- a/spec/javascripts/jasmine.HeadlessReporter.Console_spec.coffee +++ b/spec/javascripts/jasmine.HeadlessReporter.Console_spec.coffee @@ -1,35 +1,3 @@ -describe 'jasmine.HeadlessReporter', -> - reporter = null - - beforeEach -> - reporter = new jasmine.HeadlessReporter.Console() - - describe '#formatResultLine', -> - context 'length = 1', -> - it 'should format', -> - reporter.length = 1 - expect(reporter.formatResultLine(0)).toMatch(/test,/) - - context 'length != 1', -> - it 'should format', -> - reporter.length = 2 - expect(reporter.formatResultLine(0)).toMatch(/tests,/) - - context 'failedCount = 1', -> - it 'should format', -> - reporter.failedCount = 1 - expect(reporter.formatResultLine(0)).toMatch(/failure,/) - - context 'failedCount != 1', -> - it 'should format', -> - reporter.failedCount = 0 - expect(reporter.formatResultLine(0)).toMatch(/failures,/) - - context 'runtime = 1', -> - it 'should format', -> - expect(reporter.formatResultLine(1)).toMatch(/sec./) - - context 'runtime != 1', -> - it 'should format', -> - expect(reporter.formatResultLine(0)).toMatch(/secs./) +describe 'jasmine.HeadlessReporter.Console', -> + describe '#reportSpecResults', -> diff --git a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Console.coffee b/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Console.coffee index 11c51f3..0a4e75f 100644 --- a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Console.coffee +++ b/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Console.coffee @@ -1,89 +1,8 @@ -#= require jasmine.HeadlessReporter.js +#= require jasmine.HeadlessReporter.ConsoleBase # -class jasmine.HeadlessReporter.Console extends jasmine.HeadlessReporter - constructor: (@callback = null) -> - super(@callback) +class jasmine.HeadlessReporter.Console extends jasmine.HeadlessReporter.ConsoleBase + displaySuccess: (spec) => + this.print('.'.foreground('green')) - @position = 0 - @positions = "|/-\\" - - reportRunnerResults: (runner) -> - super() - - this.print("\n") - - resultLine = this.formatResultLine(this._runtime()) - - if @failedCount == 0 - this.puts("PASS: #{resultLine}".foreground('green')) - else - this.puts("FAIL: #{resultLine}".foreground('red')) - - for result in @results - this.puts(result.toString()) - - this.puts("\nTest ordering seed: --seed #{JHW.getSeed()}") - - reportRunnerStarting: (runner) -> - super(runner) - this.puts("\nRunning Jasmine specs...".bright()) if !this.hasError() - - reportSpecResults: (spec) -> - super(spec) - - this._reportSpecResult(spec, { - success: (results) => - this.print('.'.foreground('green')) - failure: (results) => - this.print('F'.foreground('red')) - - failureResult = new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName()) - testCount = 1 - - for result in results.getItems() - if result.type == 'expect' and !result.passed_ - if foundLine = result.expectations[testCount - 1] - [ result.line, result.lineNumber ] = foundLine - failureResult.addResult(result) - testCount += 1 - @results.push(failureResult) - }) - - reportSpecWaiting: -> - if !@timer - @timer = true - @first = true - - this._waitRunner() - - reportSpecRunning: -> - if @timer - clearTimeout(@timer) - @timer = null - this.print(Intense.moveBack()) - - formatResultLine: (runtime) -> - line = [] - line.push(@length) - line.push((if @length == 1 then "test" else "tests") + ',') - - line.push(@failedCount) - line.push((if @failedCount == 1 then "failure" else "failures") + ',') - - line.push(runtime) - line.push((if runtime == 1.0 then "sec" else "secs") + '.') - - line.join(' ') - - _waitRunner: => - @timer = setTimeout( - => - if @timer - this.print(Intense.moveBack()) if !@first - this.print(@positions.substr(@position, 1).foreground('yellow')) - @position += 1 - @position %= @positions.length - @first = false - this._waitRunner() - , 750 - ) + displayFailure: (spec) => + this.print('F'.foreground('red')) diff --git a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.ConsoleBase.coffee b/vendor/assets/coffeescripts/jasmine.HeadlessReporter.ConsoleBase.coffee new file mode 100644 index 0000000..543b37e --- /dev/null +++ b/vendor/assets/coffeescripts/jasmine.HeadlessReporter.ConsoleBase.coffee @@ -0,0 +1,92 @@ +#= require jasmine.HeadlessReporter.js + +class jasmine.HeadlessReporter.ConsoleBase extends jasmine.HeadlessReporter + constructor: (@callback = null) -> + super(@callback) + + @position = 0 + @positions = "|/-\\" + + formatResultLine: (runtime) -> + line = [] + line.push(@length) + line.push((if @length == 1 then "test" else "tests") + ',') + + line.push(@failedCount) + line.push((if @failedCount == 1 then "failure" else "failures") + ',') + + line.push(runtime) + line.push((if runtime == 1.0 then "sec" else "secs") + '.') + + line.join(' ') + + reportRunnerResults: (runner) -> + super() + + this.print("\n") + + resultLine = this.formatResultLine(this._runtime()) + + if @failedCount == 0 + this.puts("PASS: #{resultLine}".foreground('green')) + else + this.puts("FAIL: #{resultLine}".foreground('red')) + + for result in @results + this.puts(result.toString()) + + this.puts("\nTest ordering seed: --seed #{JHW.getSeed()}") + + reportRunnerStarting: (runner) -> + super(runner) + this.puts("\nRunning Jasmine specs...".bright()) if !this.hasError() + + reportSpecWaiting: -> + if !@timer + @timer = true + @first = true + + this._waitRunner() + + reportSpecRunning: -> + if @timer + clearTimeout(@timer) + @timer = null + this.print(Intense.moveBack()) + + reportSpecResults: (spec) -> + super(spec) + + this._reportSpecResult(spec, { + success: (results) => + this.displaySuccess(spec) + failure: (results) => + this.displayFailure(spec) + + this.reportFailureResult(results, new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName())) + }) + + reportFailureResult: (results, failureResult) -> + testCount = 1 + + for result in results.getItems() + if result.type == 'expect' and !result.passed_ + if foundLine = result.expectations[testCount - 1] + [ result.line, result.lineNumber ] = foundLine + failureResult.addResult(result) + testCount += 1 + @results.push(failureResult) + + _waitRunner: => + @timer = setTimeout( + => + if @timer + this.print(Intense.moveBack()) if !@first + this.print(@positions.substr(@position, 1).foreground('yellow')) + @position += 1 + @position %= @positions.length + @first = false + this._waitRunner() + , 750 + ) + diff --git a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee b/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee new file mode 100644 index 0000000..15551a9 --- /dev/null +++ b/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee @@ -0,0 +1,26 @@ +#= require jasmine.HeadlessReporter.ConsoleBase +# +class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleBase + displaySuccess: (spec) => + this.displaySpec(spec, 'green') + + displayFailure: (spec) => + this.displaySpec(spec, 'red') + + displaySpec: (spec, color) => + currentLastNames = (@lastNames || []).slice(0) + @lastNames = spec.getSpecSplitName() + + this.puts(this.indentSpec(@lastNames, currentLastNames, color).join("\n")) + + indentSpec: (current, last, color) => + last = last.slice(0) + + output = [] + + indent = '' + for name in current + output.push(indent + name.foreground(color)) if last.shift() != name + indent += ' ' + + output diff --git a/vendor/assets/javascripts/headless_reporter_result.js b/vendor/assets/javascripts/headless_reporter_result.js index 7fdc972..2ff7348 100644 --- a/vendor/assets/javascripts/headless_reporter_result.js +++ b/vendor/assets/javascripts/headless_reporter_result.js @@ -1,3 +1,4 @@ +(function() { window.HeadlessReporterResult = (function() { @@ -74,3 +75,5 @@ return HeadlessReporterResult; })(); + +}).call(this); diff --git a/vendor/assets/javascripts/jasmine-extensions.js b/vendor/assets/javascripts/jasmine-extensions.js index da5394c..5710fce 100644 --- a/vendor/assets/javascripts/jasmine-extensions.js +++ b/vendor/assets/javascripts/jasmine-extensions.js @@ -1,6 +1,6 @@ (function() { - var generator, getSplitName, method, pauseAndRun, _i, _len, _ref; - var __slice = Array.prototype.slice; + var generator, getSplitName, method, pauseAndRun, _i, _len, _ref, + __slice = Array.prototype.slice; if (!(typeof jasmine !== "undefined" && jasmine !== null)) { throw new Error("jasmine not laoded!"); diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.js index a28481a..cc0ea91 100644 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.js +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.js @@ -1,115 +1,28 @@ (function() { - var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; + var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + __hasProp = Object.prototype.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - jasmine.HeadlessReporter.Console = (function() { + jasmine.HeadlessReporter.Console = (function(_super) { - __extends(Console, jasmine.HeadlessReporter); + __extends(Console, _super); - function Console(callback) { - this.callback = callback != null ? callback : null; - this._waitRunner = __bind(this._waitRunner, this); - Console.__super__.constructor.call(this, this.callback); - this.position = 0; - this.positions = "|/-\\"; + function Console() { + this.displayFailure = __bind(this.displayFailure, this); + this.displaySuccess = __bind(this.displaySuccess, this); + Console.__super__.constructor.apply(this, arguments); } - Console.prototype.reportRunnerResults = function(runner) { - var result, resultLine, _i, _len, _ref; - Console.__super__.reportRunnerResults.call(this); - this.print("\n"); - resultLine = this.formatResultLine(this._runtime()); - if (this.failedCount === 0) { - this.puts(("PASS: " + resultLine).foreground('green')); - } else { - this.puts(("FAIL: " + resultLine).foreground('red')); - } - _ref = this.results; - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - result = _ref[_i]; - this.puts(result.toString()); - } - return this.puts("\nTest ordering seed: --seed " + (JHW.getSeed())); + Console.prototype.displaySuccess = function(spec) { + return this.print('.'.foreground('green')); }; - Console.prototype.reportRunnerStarting = function(runner) { - Console.__super__.reportRunnerStarting.call(this, runner); - if (!this.hasError()) { - return this.puts("\nRunning Jasmine specs...".bright()); - } - }; - - Console.prototype.reportSpecResults = function(spec) { - var _this = this; - Console.__super__.reportSpecResults.call(this, spec); - return this._reportSpecResult(spec, { - success: function(results) { - return _this.print('.'.foreground('green')); - }, - failure: function(results) { - var failureResult, foundLine, result, testCount, _i, _len, _ref; - _this.print('F'.foreground('red')); - failureResult = new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName()); - testCount = 1; - _ref = results.getItems(); - for (_i = 0, _len = _ref.length; _i < _len; _i++) { - result = _ref[_i]; - if (result.type === 'expect' && !result.passed_) { - if (foundLine = result.expectations[testCount - 1]) { - result.line = foundLine[0], result.lineNumber = foundLine[1]; - } - failureResult.addResult(result); - } - testCount += 1; - } - return _this.results.push(failureResult); - } - }); - }; - - Console.prototype.reportSpecWaiting = function() { - if (!this.timer) { - this.timer = true; - this.first = true; - return this._waitRunner(); - } - }; - - Console.prototype.reportSpecRunning = function() { - if (this.timer) { - clearTimeout(this.timer); - this.timer = null; - return this.print(Intense.moveBack()); - } - }; - - Console.prototype.formatResultLine = function(runtime) { - var line; - line = []; - line.push(this.length); - line.push((this.length === 1 ? "test" : "tests") + ','); - line.push(this.failedCount); - line.push((this.failedCount === 1 ? "failure" : "failures") + ','); - line.push(runtime); - line.push((runtime === 1.0 ? "sec" : "secs") + '.'); - return line.join(' '); - }; - - Console.prototype._waitRunner = function() { - var _this = this; - return this.timer = setTimeout(function() { - if (_this.timer) { - if (!_this.first) _this.print(Intense.moveBack()); - _this.print(_this.positions.substr(_this.position, 1).foreground('yellow')); - _this.position += 1; - _this.position %= _this.positions.length; - _this.first = false; - return _this._waitRunner(); - } - }, 750); + Console.prototype.displayFailure = function(spec) { + return this.print('F'.foreground('red')); }; return Console; - })(); + })(jasmine.HeadlessReporter.ConsoleBase); }).call(this); diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.js new file mode 100644 index 0000000..6df7d8a --- /dev/null +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.js @@ -0,0 +1,120 @@ +(function() { + var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + __hasProp = Object.prototype.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; + + jasmine.HeadlessReporter.ConsoleBase = (function(_super) { + + __extends(ConsoleBase, _super); + + function ConsoleBase(callback) { + this.callback = callback != null ? callback : null; + this._waitRunner = __bind(this._waitRunner, this); + ConsoleBase.__super__.constructor.call(this, this.callback); + this.position = 0; + this.positions = "|/-\\"; + } + + ConsoleBase.prototype.formatResultLine = function(runtime) { + var line; + line = []; + line.push(this.length); + line.push((this.length === 1 ? "test" : "tests") + ','); + line.push(this.failedCount); + line.push((this.failedCount === 1 ? "failure" : "failures") + ','); + line.push(runtime); + line.push((runtime === 1.0 ? "sec" : "secs") + '.'); + return line.join(' '); + }; + + ConsoleBase.prototype.reportRunnerResults = function(runner) { + var result, resultLine, _i, _len, _ref; + ConsoleBase.__super__.reportRunnerResults.call(this); + this.print("\n"); + resultLine = this.formatResultLine(this._runtime()); + if (this.failedCount === 0) { + this.puts(("PASS: " + resultLine).foreground('green')); + } else { + this.puts(("FAIL: " + resultLine).foreground('red')); + } + _ref = this.results; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + result = _ref[_i]; + this.puts(result.toString()); + } + return this.puts("\nTest ordering seed: --seed " + (JHW.getSeed())); + }; + + ConsoleBase.prototype.reportRunnerStarting = function(runner) { + ConsoleBase.__super__.reportRunnerStarting.call(this, runner); + if (!this.hasError()) { + return this.puts("\nRunning Jasmine specs...".bright()); + } + }; + + ConsoleBase.prototype.reportSpecWaiting = function() { + if (!this.timer) { + this.timer = true; + this.first = true; + return this._waitRunner(); + } + }; + + ConsoleBase.prototype.reportSpecRunning = function() { + if (this.timer) { + clearTimeout(this.timer); + this.timer = null; + return this.print(Intense.moveBack()); + } + }; + + ConsoleBase.prototype.reportSpecResults = function(spec) { + var _this = this; + ConsoleBase.__super__.reportSpecResults.call(this, spec); + return this._reportSpecResult(spec, { + success: function(results) { + return _this.displaySuccess(spec); + }, + failure: function(results) { + _this.displayFailure(spec); + return _this.reportFailureResult(results, new HeadlessReporterResult(spec.getFullName(), spec.getSpecSplitName())); + } + }); + }; + + ConsoleBase.prototype.reportFailureResult = function(results, failureResult) { + var foundLine, result, testCount, _i, _len, _ref; + testCount = 1; + _ref = results.getItems(); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + result = _ref[_i]; + if (result.type === 'expect' && !result.passed_) { + if (foundLine = result.expectations[testCount - 1]) { + result.line = foundLine[0], result.lineNumber = foundLine[1]; + } + failureResult.addResult(result); + } + testCount += 1; + } + return this.results.push(failureResult); + }; + + ConsoleBase.prototype._waitRunner = function() { + var _this = this; + return this.timer = setTimeout(function() { + if (_this.timer) { + if (!_this.first) _this.print(Intense.moveBack()); + _this.print(_this.positions.substr(_this.position, 1).foreground('yellow')); + _this.position += 1; + _this.position %= _this.positions.length; + _this.first = false; + return _this._waitRunner(); + } + }, 750); + }; + + return ConsoleBase; + + })(jasmine.HeadlessReporter); + +}).call(this); diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.File.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.File.js index 126d40b..f15dce9 100644 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.File.js +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.File.js @@ -1,9 +1,10 @@ (function() { - var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; + var __hasProp = Object.prototype.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - jasmine.HeadlessReporter.File = (function() { + jasmine.HeadlessReporter.File = (function(_super) { - __extends(File, jasmine.HeadlessReporter); + __extends(File, _super); function File() { File.__super__.constructor.apply(this, arguments); @@ -36,6 +37,6 @@ return File; - })(); + })(jasmine.HeadlessReporter); }).call(this); diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.js index f2ed49c..6d16feb 100644 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.js +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.js @@ -1,9 +1,10 @@ (function() { - var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; + var __hasProp = Object.prototype.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; - jasmine.HeadlessReporter.Tap = (function() { + jasmine.HeadlessReporter.Tap = (function(_super) { - __extends(Tap, jasmine.HeadlessReporter); + __extends(Tap, _super); function Tap(outputTarget) { this.outputTarget = outputTarget != null ? outputTarget : null; @@ -18,8 +19,8 @@ }; Tap.prototype.reportSpecResults = function(spec) { - var description, index; - var _this = this; + var description, index, + _this = this; Tap.__super__.reportSpecResults.call(this, spec); index = this.output.length + 1; description = spec.getSpecSplitName().join(' '); @@ -35,6 +36,6 @@ return Tap; - })(); + })(jasmine.HeadlessReporter); }).call(this); diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js new file mode 100644 index 0000000..90acb5f --- /dev/null +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js @@ -0,0 +1,50 @@ +(function() { + var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }, + __hasProp = Object.prototype.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor; child.__super__ = parent.prototype; return child; }; + + jasmine.HeadlessReporter.Verbose = (function(_super) { + + __extends(Verbose, _super); + + function Verbose() { + this.indentSpec = __bind(this.indentSpec, this); + this.displaySpec = __bind(this.displaySpec, this); + this.displayFailure = __bind(this.displayFailure, this); + this.displaySuccess = __bind(this.displaySuccess, this); + Verbose.__super__.constructor.apply(this, arguments); + } + + Verbose.prototype.displaySuccess = function(spec) { + return this.displaySpec(spec, 'green'); + }; + + Verbose.prototype.displayFailure = function(spec) { + return this.displaySpec(spec, 'red'); + }; + + Verbose.prototype.displaySpec = function(spec, color) { + var currentLastNames; + currentLastNames = (this.lastNames || []).slice(0); + this.lastNames = spec.getSpecSplitName(); + return this.puts(this.indentSpec(this.lastNames, currentLastNames, color).join("\n")); + }; + + Verbose.prototype.indentSpec = function(current, last, color) { + var indent, name, output, _i, _len; + last = last.slice(0); + output = []; + indent = ''; + for (_i = 0, _len = current.length; _i < _len; _i++) { + name = current[_i]; + if (last.shift() !== name) output.push(indent + name.foreground(color)); + indent += ' '; + } + return output; + }; + + return Verbose; + + })(jasmine.HeadlessReporter.ConsoleBase); + +}).call(this); diff --git a/vendor/assets/javascripts/prolog.js b/vendor/assets/javascripts/prolog.js index 72a490f..1871ed3 100644 --- a/vendor/assets/javascripts/prolog.js +++ b/vendor/assets/javascripts/prolog.js @@ -1,5 +1,6 @@ (function() { var puts; + if (window.JHW) { window.console = { log: function(data) { @@ -43,9 +44,7 @@ e = e || window.event; JHW.hasError(); puts("The code tried to leave the test page. Check for unhandled form submits and link clicks."); - if (e) { - e.returnValue = 'string'; - } + if (e) e.returnValue = 'string'; return 'string'; }; JHW._hasErrors = false; @@ -75,14 +74,15 @@ _ref = jasmine.getEnv().reporter.subReporters_; for (_i = 0, _len = _ref.length; _i < _len; _i++) { reporter = _ref[_i]; - if (reporter.consoleLogUsed != null) { - reporter.consoleLogUsed(msg); - } + if (reporter.consoleLogUsed != null) reporter.consoleLogUsed(msg); } JHW._usedConsole = true; return puts(msg); }; } + window.CoffeeScriptToFilename = {}; + window.CSTF = window.CoffeeScriptToFilename; + }).call(this);