diff --git a/skel/template.html.erb b/skel/template.html.erb
index 05f7038..4da2057 100644
--- a/skel/template.html.erb
+++ b/skel/template.html.erb
@@ -23,7 +23,15 @@
if (window.JHW) {
jasmine.getEnv().addReporter(new jasmine.HeadlessConsoleReporter());
} else {
- jasmine.getEnv().addReporter(new jasmine.HtmlReporter());
+ types = [ 'HtmlReporter', 'TrivialReporter' ];
+
+ for (var i = 0, j = types.length; i < j; ++i) {
+ var type = jasmine[types[i]]
+ if (type) {
+ jasmine.getEnv().addReporter(new type());
+ break;
+ }
+ }
}
jasmine.getEnv().execute();
diff --git a/vendor/assets/coffeescripts/headless_reporter_result.coffee b/vendor/assets/coffeescripts/headless_reporter_result.coffee
index 077b571..0c8e752 100644
--- a/vendor/assets/coffeescripts/headless_reporter_result.coffee
+++ b/vendor/assets/coffeescripts/headless_reporter_result.coffee
@@ -11,7 +11,7 @@ class window.HeadlessReporterResult
bestChoice = HeadlessReporterResult.findSpecLine(@splitName)
output += " (#{bestChoice.file}:#{bestChoice.lineNumber})".foreground('blue') if bestChoice.file
- JHW.stdout.puts "\n\n#{output}"
+ JHW.stdout.puts "\n#{output}"
for result in @results
output = result.message.foreground('red')
if result.lineNumber
diff --git a/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee b/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee
index 3bdedd0..aee9087 100644
--- a/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee
+++ b/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee
@@ -37,7 +37,7 @@ class jasmine.HeadlessConsoleReporter
reportRunnerStarting: (runner) ->
@startTime = new Date()
- JHW.stdout.puts("\nRunning Jasmine specs...".bright())
+ JHW.stdout.puts("\nRunning Jasmine specs...".bright()) if !this.hasError()
reportSpecResults: (spec) ->
return if this.hasError()
diff --git a/vendor/assets/javascripts/headless_reporter_result.js b/vendor/assets/javascripts/headless_reporter_result.js
index 92ec7b9..5498284 100644
--- a/vendor/assets/javascripts/headless_reporter_result.js
+++ b/vendor/assets/javascripts/headless_reporter_result.js
@@ -1,16 +1,13 @@
-
+(function() {
window.HeadlessReporterResult = (function() {
-
function HeadlessReporterResult(name, splitName) {
this.name = name;
this.splitName = splitName;
this.results = [];
}
-
HeadlessReporterResult.prototype.addResult = function(message) {
return this.results.push(message);
};
-
HeadlessReporterResult.prototype.print = function() {
var bestChoice, output, result, _i, _len, _ref, _results;
output = this.name.foreground('red');
@@ -18,7 +15,7 @@
if (bestChoice.file) {
output += (" (" + bestChoice.file + ":" + bestChoice.lineNumber + ")").foreground('blue');
}
- JHW.stdout.puts("\n\n" + output);
+ JHW.stdout.puts("\n" + output);
_ref = this.results;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
@@ -28,15 +25,10 @@
output += (" (line ~" + (bestChoice.lineNumber + result.lineNumber) + ")").foreground('red').bright();
}
JHW.stdout.puts(" " + output);
- if (result.line != null) {
- _results.push(JHW.stdout.puts((" " + result.line).foreground('yellow')));
- } else {
- _results.push(void 0);
- }
+ _results.push(result.line != null ? JHW.stdout.puts((" " + result.line).foreground('yellow')) : void 0);
}
return _results;
};
-
HeadlessReporterResult.findSpecLine = function(splitName) {
var bestChoice, file, index, lastLine, line, lineNumber, lines, newLineNumberInfo, _i, _len, _ref;
bestChoice = {
@@ -57,7 +49,9 @@
for (_i = 0, _len = newLineNumberInfo.length; _i < _len; _i++) {
line = newLineNumberInfo[_i];
lastLine = line;
- if (line > lineNumber) break;
+ if (line > lineNumber) {
+ break;
+ }
}
lineNumber = lastLine;
}
@@ -73,7 +67,6 @@
}
return bestChoice;
};
-
return HeadlessReporterResult;
-
})();
+}).call(this);
diff --git a/vendor/assets/javascripts/intense.js b/vendor/assets/javascripts/intense.js
index 8341721..73b1556 100644
--- a/vendor/assets/javascripts/intense.js
+++ b/vendor/assets/javascripts/intense.js
@@ -1,6 +1,5 @@
(function() {
var code, method, _ref;
-
window.Intense = {
colors: {
black: 0,
@@ -30,15 +29,15 @@
},
useColors: true,
moveBack: function(count) {
- if (count == null) count = 1;
+ 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..c45e757 100644
--- a/vendor/assets/javascripts/jasmine-extensions.js
+++ b/vendor/assets/javascripts/jasmine-extensions.js
@@ -1,11 +1,9 @@
(function() {
var generator, getSplitName, method, pauseAndRun, _i, _len, _ref;
var __slice = Array.prototype.slice;
-
if (!(typeof jasmine !== "undefined" && jasmine !== null)) {
throw new Error("jasmine not laoded!");
}
-
if (window.JHW) {
getSplitName = function(parts) {
parts.push(String(this.description).replace(/[\n\r]/g, ' '));
@@ -112,11 +110,7 @@
_results = [];
for (_j = 0, _len2 = _ref2.length; _j < _len2; _j++) {
reporter = _ref2[_j];
- if (reporter[method] != null) {
- _results.push(reporter[method].apply(reporter, args));
- } else {
- _results.push(void 0);
- }
+ _results.push(reporter[method] != null ? reporter[method].apply(reporter, args) : void 0);
}
return _results;
};
@@ -125,5 +119,4 @@
}
}
}
-
}).call(this);
diff --git a/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js b/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js
index e96bbb7..e81a776 100644
--- a/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js
+++ b/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js
@@ -1,10 +1,9 @@
-
+(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.HeadlessConsoleReporter = (function() {
-
function HeadlessConsoleReporter(callback) {
this.callback = callback != null ? callback : null;
this.results = [];
@@ -14,10 +13,11 @@
this.position = 0;
this.positions = "|/-\\";
}
-
HeadlessConsoleReporter.prototype.reportRunnerResults = function(runner) {
var output, result, resultLine, runtime, _i, _len, _ref;
- if (this.hasError()) return;
+ if (this.hasError()) {
+ return;
+ }
runtime = (new Date() - this.startTime) / 1000.0;
JHW.stdout.print("\n");
resultLine = this._formatResultLine(runtime);
@@ -34,18 +34,22 @@
result = _ref[_i];
result.print();
}
- if (window.JHW) window.onbeforeunload = null;
+ if (window.JHW) {
+ window.onbeforeunload = null;
+ }
return JHW.finishSuite();
};
-
HeadlessConsoleReporter.prototype.reportRunnerStarting = function(runner) {
this.startTime = new Date();
- return JHW.stdout.puts("\nRunning Jasmine specs...".bright());
+ if (!this.hasError()) {
+ return JHW.stdout.puts("\nRunning Jasmine specs...".bright());
+ }
};
-
HeadlessConsoleReporter.prototype.reportSpecResults = function(spec) {
var failureResult, foundLine, result, results, testCount, _i, _len, _ref;
- if (this.hasError()) return;
+ if (this.hasError()) {
+ return;
+ }
JHW.ping();
results = spec.results();
this.length++;
@@ -72,37 +76,35 @@
return this.results.push(failureResult);
}
};
-
HeadlessConsoleReporter.prototype.reportSpecStarting = function(spec) {
if (this.hasError()) {
spec.finish();
return spec.suite.finish();
}
};
-
HeadlessConsoleReporter.prototype.reportSpecWaiting = function() {
var first, runner;
- var _this = this;
runner = null;
if (!this.timer) {
this.timer = true;
first = true;
- runner = function() {
- return _this.timer = setTimeout(function() {
- if (_this.timer) {
- if (!first) JHW.stdout.print(Intense.moveBack());
- JHW.stdout.print(_this.positions.substr(_this.position, 1).foreground('yellow'));
- _this.position += 1;
- _this.position %= _this.positions.length;
+ runner = __bind(function() {
+ return this.timer = setTimeout(__bind(function() {
+ if (this.timer) {
+ if (!first) {
+ JHW.stdout.print(Intense.moveBack());
+ }
+ JHW.stdout.print(this.positions.substr(this.position, 1).foreground('yellow'));
+ this.position += 1;
+ this.position %= this.positions.length;
first = false;
return runner();
}
- }, 750);
- };
+ }, this), 750);
+ }, this);
return runner();
}
};
-
HeadlessConsoleReporter.prototype.reportSpecRunning = function() {
if (this.timer) {
clearTimeout(this.timer);
@@ -110,13 +112,10 @@
return JHW.stdout.print(Intense.moveBack());
}
};
-
HeadlessConsoleReporter.prototype.reportSuiteResults = function(suite) {};
-
HeadlessConsoleReporter.prototype.hasError = function() {
return JHW._hasErrors;
};
-
HeadlessConsoleReporter.prototype._formatResultLine = function(runtime) {
var line;
line = [];
@@ -128,7 +127,6 @@
line.push((runtime === 1.0 ? "sec" : "secs") + '.');
return line.join(' ');
};
-
return HeadlessConsoleReporter;
-
})();
+}).call(this);
diff --git a/vendor/assets/javascripts/prolog.js b/vendor/assets/javascripts/prolog.js
index eb2b69f..2fd358b 100644
--- a/vendor/assets/javascripts/prolog.js
+++ b/vendor/assets/javascripts/prolog.js
@@ -1,6 +1,5 @@
(function() {
var createHandle, handle, _i, _len, _ref;
-
if (window.JHW) {
window.console = {
log: function(data) {
@@ -41,7 +40,9 @@
e = e || window.event;
JHW.hasError();
JHW.stdout.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';
};
window.confirm = function(message) {
@@ -83,9 +84,6 @@
return JHW.stdout.puts(msg);
};
}
-
window.CoffeeScriptToFilename = {};
-
window.CSTF = window.CoffeeScriptToFilename;
-
}).call(this);