From ed76916205a216b27d193a48a986de4aabcdccb1 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 11 Jan 2012 14:24:09 -0500 Subject: [PATCH] more cleanup --- Gemfile | 11 +- lib/digest/jasmine_test.rb | 20 --- lib/jasmine-headless-webkit.rb | 4 - lib/jasmine/headless/task.rb | 14 --- .../javascripts/headless_reporter_result.js | 3 + .../intense.coffee | 0 vendor/assets/javascripts/intense.js | 44 ------- .../assets/javascripts/jasmine-extensions.js | 4 +- .../jasmine.HeadlessReporter.Console.coffee | 0 .../jasmine.HeadlessReporter.Console.js | 26 ---- ...asmine.HeadlessReporter.ConsoleBase.coffee | 2 +- .../jasmine.HeadlessReporter.ConsoleBase.js | 118 ------------------ .../jasmine.HeadlessReporter.File.coffee | 2 +- .../jasmine.HeadlessReporter.File.js | 41 ------ .../jasmine.HeadlessReporter.Tap.coffee | 2 +- .../jasmine.HeadlessReporter.Tap.js | 40 ------ .../jasmine.HeadlessReporter.Verbose.coffee | 4 +- .../jasmine.HeadlessReporter.Verbose.js | 72 ----------- .../jasmine.HeadlessReporter.coffee | 0 .../javascripts/jasmine.HeadlessReporter.js | 77 ------------ 20 files changed, 14 insertions(+), 470 deletions(-) delete mode 100644 lib/digest/jasmine_test.rb rename vendor/assets/{coffeescripts => javascripts}/intense.coffee (100%) delete mode 100644 vendor/assets/javascripts/intense.js rename vendor/assets/{coffeescripts => javascripts}/jasmine.HeadlessReporter.Console.coffee (100%) delete mode 100644 vendor/assets/javascripts/jasmine.HeadlessReporter.Console.js rename vendor/assets/{coffeescripts => javascripts}/jasmine.HeadlessReporter.ConsoleBase.coffee (98%) delete mode 100644 vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.js rename vendor/assets/{coffeescripts => javascripts}/jasmine.HeadlessReporter.File.coffee (94%) delete mode 100644 vendor/assets/javascripts/jasmine.HeadlessReporter.File.js rename vendor/assets/{coffeescripts => javascripts}/jasmine.HeadlessReporter.Tap.coffee (94%) delete mode 100644 vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.js rename vendor/assets/{coffeescripts => javascripts}/jasmine.HeadlessReporter.Verbose.coffee (87%) delete mode 100644 vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js rename vendor/assets/{coffeescripts => javascripts}/jasmine.HeadlessReporter.coffee (100%) delete mode 100644 vendor/assets/javascripts/jasmine.HeadlessReporter.js diff --git a/Gemfile b/Gemfile index 45b425a..eaf2cd4 100644 --- a/Gemfile +++ b/Gemfile @@ -15,22 +15,17 @@ gem 'guard-cucumber' require 'rbconfig' case RbConfig::CONFIG['host_os'] when /darwin/ - gem 'growl' gem 'rb-fsevent' when /linux/ gem 'libnotify' end -gem 'growl' -gem 'rake', '0.8.7' -gem 'mocha', '0.9.12' -gem 'guard-jasmine-headless-webkit', :git => 'git://github.com/johnbintz/guard-jasmine-headless-webkit.git' -gem 'facter' +gem 'mocha' gem 'cucumber' -gem 'jquery-rails' +gem 'jquery-rails', '~> 1.0.0' gem 'ejs' -gem 'simplecov' +gem 'guard-jasmine-headless-webkit', :git => 'git://github.com/johnbintz/guard-jasmine-headless-webkit.git' diff --git a/lib/digest/jasmine_test.rb b/lib/digest/jasmine_test.rb deleted file mode 100644 index f29e207..0000000 --- a/lib/digest/jasmine_test.rb +++ /dev/null @@ -1,20 +0,0 @@ -module Digest - class JasmineTest - def self.file(file) - new - end - - def file(file) - self - end - - def hexdigest - 'test' - end - - def update(prefix) - self - end - end -end - diff --git a/lib/jasmine-headless-webkit.rb b/lib/jasmine-headless-webkit.rb index a99ab37..556c370 100644 --- a/lib/jasmine-headless-webkit.rb +++ b/lib/jasmine-headless-webkit.rb @@ -1,7 +1,3 @@ require 'jasmine/headless' require 'jasmine/headless/railtie' if defined?(Rails) && Rails::VERSION::MAJOR >= 3 -module Digest - autoload :JasmineTest, 'digest/jasmine_test' -end - diff --git a/lib/jasmine/headless/task.rb b/lib/jasmine/headless/task.rb index 3368c6b..058a33c 100644 --- a/lib/jasmine/headless/task.rb +++ b/lib/jasmine/headless/task.rb @@ -14,23 +14,9 @@ module Jasmine desc 'Run Jasmine specs headlessly' task(name) { run_rake_task } - - create_rails_compliant_task if defined?(Rails) end private - def create_rails_compliant_task - if Rails.respond_to?(:version) && Rails.version >= "3.1.0" - task 'assets:precompile:for_testing' => :environment do - $stderr.puts "This task is deprecated and will be removed after 2012-01-01" - - Rails.application.assets.digest_class = Digest::JasmineTest - - Rake::Task['assets:precompile'].invoke - end - end - end - def run_rake_task case Jasmine::Headless::Runner.run( :colors => colors, 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/coffeescripts/intense.coffee b/vendor/assets/javascripts/intense.coffee similarity index 100% rename from vendor/assets/coffeescripts/intense.coffee rename to vendor/assets/javascripts/intense.coffee diff --git a/vendor/assets/javascripts/intense.js b/vendor/assets/javascripts/intense.js deleted file mode 100644 index 8341721..0000000 --- a/vendor/assets/javascripts/intense.js +++ /dev/null @@ -1,44 +0,0 @@ -(function() { - var code, method, _ref; - - window.Intense = { - colors: { - black: 0, - red: 1, - green: 2, - yellow: 3, - blue: 4, - magenta: 5, - cyan: 6, - white: 7 - }, - methods: { - foreground: function(color) { - if (Intense.useColors) { - return "\033[3" + Intense.colors[color] + "m" + this + "\033[0m"; - } else { - return this; - } - }, - bright: function() { - if (Intense.useColors) { - return "\033[1m" + this + "\033[0m"; - } else { - return this; - } - } - }, - useColors: true, - moveBack: function(count) { - if (count == null) count = 1; - return "\033[" + count + "D"; - } - }; - - _ref = Intense.methods; - for (method in _ref) { - code = _ref[method]; - String.prototype[method] = code; - } - -}).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/coffeescripts/jasmine.HeadlessReporter.Console.coffee b/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.coffee similarity index 100% rename from vendor/assets/coffeescripts/jasmine.HeadlessReporter.Console.coffee rename to vendor/assets/javascripts/jasmine.HeadlessReporter.Console.coffee diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.js deleted file mode 100644 index 9bf301a..0000000 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.js +++ /dev/null @@ -1,26 +0,0 @@ -(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.Console = (function() { - - __extends(Console, jasmine.HeadlessReporter.ConsoleBase); - - function Console() { - this.displayFailure = __bind(this.displayFailure, this); - this.displaySuccess = __bind(this.displaySuccess, this); - Console.__super__.constructor.apply(this, arguments); - } - - Console.prototype.displaySuccess = function(spec) { - return this.print('.'.foreground('green')); - }; - - Console.prototype.displayFailure = function(spec) { - return this.print('F'.foreground('red')); - }; - - return Console; - - })(); - -}).call(this); diff --git a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.ConsoleBase.coffee b/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.coffee similarity index 98% rename from vendor/assets/coffeescripts/jasmine.HeadlessReporter.ConsoleBase.coffee rename to vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.coffee index 543b37e..0c729aa 100644 --- a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.ConsoleBase.coffee +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.coffee @@ -1,4 +1,4 @@ -#= require jasmine.HeadlessReporter.js +#= require jasmine.HeadlessReporter class jasmine.HeadlessReporter.ConsoleBase extends jasmine.HeadlessReporter constructor: (@callback = null) -> diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.js deleted file mode 100644 index 8705d5d..0000000 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.js +++ /dev/null @@ -1,118 +0,0 @@ -(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() { - - __extends(ConsoleBase, jasmine.HeadlessReporter); - - 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; - - })(); - -}).call(this); diff --git a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.File.coffee b/vendor/assets/javascripts/jasmine.HeadlessReporter.File.coffee similarity index 94% rename from vendor/assets/coffeescripts/jasmine.HeadlessReporter.File.coffee rename to vendor/assets/javascripts/jasmine.HeadlessReporter.File.coffee index 424a0ea..d862d1a 100644 --- a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.File.coffee +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.File.coffee @@ -1,4 +1,4 @@ -#= require jasmine.HeadlessReporter.js +#= require jasmine.HeadlessReporter # class jasmine.HeadlessReporter.File extends jasmine.HeadlessReporter reportRunnerResults: (runner) -> diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.File.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.File.js deleted file mode 100644 index 126d40b..0000000 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.File.js +++ /dev/null @@ -1,41 +0,0 @@ -(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; }; - - jasmine.HeadlessReporter.File = (function() { - - __extends(File, jasmine.HeadlessReporter); - - function File() { - File.__super__.constructor.apply(this, arguments); - } - - File.prototype.reportRunnerResults = function(runner) { - var output; - File.__super__.reportRunnerResults.call(this, runner); - output = "TOTAL||" + this.length + "||" + this.failedCount + "||" + (this._runtime()) + "||" + (JHW._hasErrors ? "T" : "F"); - this.puts(output); - return this.puts("SEED||" + (JHW.getSeed())); - }; - - File.prototype.consoleLogUsed = function(msg) { - return this.puts("CONSOLE||" + msg); - }; - - File.prototype.reportSpecResults = function(spec) { - var _this = this; - File.__super__.reportSpecResults.call(this, spec); - return this._reportSpecResult(spec, { - success: function(results) { - return _this.puts("PASS||" + spec.getJHWSpecInformation()); - }, - failure: function(results) { - return _this.puts("FAIL||" + spec.getJHWSpecInformation()); - } - }); - }; - - return File; - - })(); - -}).call(this); diff --git a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Tap.coffee b/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.coffee similarity index 94% rename from vendor/assets/coffeescripts/jasmine.HeadlessReporter.Tap.coffee rename to vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.coffee index ccd0015..3aa90fe 100644 --- a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Tap.coffee +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.coffee @@ -1,4 +1,4 @@ -#= require jasmine.HeadlessReporter.js +#= require jasmine.HeadlessReporter class jasmine.HeadlessReporter.Tap extends jasmine.HeadlessReporter constructor: (@outputTarget = null) -> diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.js deleted file mode 100644 index f2ed49c..0000000 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.js +++ /dev/null @@ -1,40 +0,0 @@ -(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; }; - - jasmine.HeadlessReporter.Tap = (function() { - - __extends(Tap, jasmine.HeadlessReporter); - - function Tap(outputTarget) { - this.outputTarget = outputTarget != null ? outputTarget : null; - Tap.__super__.constructor.call(this, this.outputTarget); - this.output = []; - } - - Tap.prototype.reportRunnerResults = function(runner) { - Tap.__super__.reportRunnerResults.call(this, runner); - if (this.output.length > 0) this.output.unshift("1.." + this.output.length); - return this.puts(this.output.join("\n")); - }; - - Tap.prototype.reportSpecResults = function(spec) { - var description, index; - var _this = this; - Tap.__super__.reportSpecResults.call(this, spec); - index = this.output.length + 1; - description = spec.getSpecSplitName().join(' '); - return this._reportSpecResult(spec, { - success: function(results) { - return _this.output.push("ok " + index + " " + description); - }, - failure: function(results) { - return _this.output.push("not ok " + index + " " + description); - } - }); - }; - - return Tap; - - })(); - -}).call(this); diff --git a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee b/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee similarity index 87% rename from vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee rename to vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee index 51028f8..605bb5f 100644 --- a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee +++ b/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee @@ -11,7 +11,9 @@ class jasmine.HeadlessReporter.Verbose extends jasmine.HeadlessReporter.ConsoleB currentLastNames = (@lastNames || []).slice(0) @lastNames = spec.getSpecSplitName() - this.puts(this.indentSpec(@lastNames, currentLastNames, color).join("\n")) + for line in this.indentSpec(@lastNames, currentLastNames, color) + if line? and !_.isEmpty(line) + this.puts(line) indentSpec: (current, last, color) => last = last.slice(0) diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js deleted file mode 100644 index 19e27b4..0000000 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js +++ /dev/null @@ -1,72 +0,0 @@ -(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() { - - __extends(Verbose, jasmine.HeadlessReporter.ConsoleBase); - - function Verbose() { - this.colorLine = __bind(this.colorLine, this); - this.indentLines = __bind(this.indentLines, this); - 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 lines, name, _i, _len; - last = last.slice(0); - lines = []; - for (_i = 0, _len = current.length; _i < _len; _i++) { - name = current[_i]; - if (last.shift() !== name) { - lines.push(name); - } else { - lines.push(null); - } - } - return this.indentLines(lines, color); - }; - - Verbose.prototype.indentLines = function(lines, color) { - var indent, line, output, outputLine, _i, _len; - indent = ''; - output = []; - for (_i = 0, _len = lines.length; _i < _len; _i++) { - line = lines[_i]; - if (line != null) { - outputLine = indent; - outputLine += this.colorLine(line, color); - output.push(outputLine); - } - indent += ' '; - } - return output; - }; - - Verbose.prototype.colorLine = function(line, color) { - return line.foreground(color); - }; - - return Verbose; - - })(); - -}).call(this); diff --git a/vendor/assets/coffeescripts/jasmine.HeadlessReporter.coffee b/vendor/assets/javascripts/jasmine.HeadlessReporter.coffee similarity index 100% rename from vendor/assets/coffeescripts/jasmine.HeadlessReporter.coffee rename to vendor/assets/javascripts/jasmine.HeadlessReporter.coffee diff --git a/vendor/assets/javascripts/jasmine.HeadlessReporter.js b/vendor/assets/javascripts/jasmine.HeadlessReporter.js deleted file mode 100644 index 41a43ce..0000000 --- a/vendor/assets/javascripts/jasmine.HeadlessReporter.js +++ /dev/null @@ -1,77 +0,0 @@ -(function() { - var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; - - if (!(typeof jasmine !== "undefined" && jasmine !== null)) { - throw new Error("jasmine not loaded!"); - } - - jasmine.HeadlessReporter = (function() { - - function HeadlessReporter(outputTarget) { - this.outputTarget = outputTarget != null ? outputTarget : null; - this.puts = __bind(this.puts, this); - this.print = __bind(this.print, this); - this.results = []; - this.failedCount = 0; - this.length = 0; - this.timer = null; - } - - HeadlessReporter.prototype.hasError = function() { - return JHW._hasErrors; - }; - - HeadlessReporter.prototype.reportSpecStarting = function(spec) { - if (this.hasError()) { - spec.finish(); - return spec.suite.finish(); - } - }; - - HeadlessReporter.prototype.reportSuiteResults = function(suite) {}; - - HeadlessReporter.prototype.reportRunnerStarting = function(runner) { - return this.startTime = new Date(); - }; - - HeadlessReporter.prototype.reportRunnerResults = function(runner) { - if (this.hasError()) return; - if (this.failedCount !== 0) JHW.hasSpecFailure(); - JHW.finishSuite(); - if (window.JHW) return window.onbeforeunload = null; - }; - - HeadlessReporter.prototype.reportSpecResults = function(spec) { - if (this.hasError()) return; - return JHW.ping(); - }; - - HeadlessReporter.prototype._reportSpecResult = function(spec, options) { - var results; - results = spec.results(); - this.length++; - if (results.passed()) { - return options.success(results, spec); - } else { - this.failedCount++; - return options.failure(results, spec); - } - }; - - HeadlessReporter.prototype._runtime = function() { - return (new Date() - this.startTime) / 1000.0; - }; - - HeadlessReporter.prototype.print = function(output) { - return JHW.print(this.outputTarget, output); - }; - - HeadlessReporter.prototype.puts = function(output) { - return JHW.print(this.outputTarget, output + "\n"); - }; - - return HeadlessReporter; - - })(); - -}).call(this);