merge
This commit is contained in:
commit
282ed40264
@ -72,6 +72,7 @@ module Jasmine::Headless
|
|||||||
def default_files
|
def default_files
|
||||||
%w{jasmine.js jasmine-html jasmine.css jasmine-extensions
|
%w{jasmine.js jasmine-html jasmine.css jasmine-extensions
|
||||||
intense headless_reporter_result jasmine.HeadlessReporter
|
intense headless_reporter_result jasmine.HeadlessReporter
|
||||||
|
jasmine.HeadlessReporter.ConsoleBase
|
||||||
jsDump beautify-html}
|
jsDump beautify-html}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -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./)
|
||||||
|
|
@ -1,35 +1,3 @@
|
|||||||
describe 'jasmine.HeadlessReporter', ->
|
describe 'jasmine.HeadlessReporter.Console', ->
|
||||||
reporter = null
|
describe '#reportSpecResults', ->
|
||||||
|
|
||||||
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./)
|
|
||||||
|
|
||||||
|
@ -1,89 +1,8 @@
|
|||||||
#= require jasmine.HeadlessReporter.js
|
#= require jasmine.HeadlessReporter.ConsoleBase
|
||||||
#
|
#
|
||||||
class jasmine.HeadlessReporter.Console extends jasmine.HeadlessReporter
|
class jasmine.HeadlessReporter.Console extends jasmine.HeadlessReporter.ConsoleBase
|
||||||
constructor: (@callback = null) ->
|
displaySuccess: (spec) =>
|
||||||
super(@callback)
|
this.print('.'.foreground('green'))
|
||||||
|
|
||||||
@position = 0
|
displayFailure: (spec) =>
|
||||||
@positions = "|/-\\"
|
this.print('F'.foreground('red'))
|
||||||
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
92
vendor/assets/coffeescripts/jasmine.HeadlessReporter.ConsoleBase.coffee
vendored
Normal file
92
vendor/assets/coffeescripts/jasmine.HeadlessReporter.ConsoleBase.coffee
vendored
Normal file
@ -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
|
||||||
|
)
|
||||||
|
|
26
vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee
vendored
Normal file
26
vendor/assets/coffeescripts/jasmine.HeadlessReporter.Verbose.coffee
vendored
Normal file
@ -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
|
@ -3,109 +3,20 @@
|
|||||||
|
|
||||||
jasmine.HeadlessReporter.Console = (function() {
|
jasmine.HeadlessReporter.Console = (function() {
|
||||||
|
|
||||||
__extends(Console, jasmine.HeadlessReporter);
|
__extends(Console, jasmine.HeadlessReporter.ConsoleBase);
|
||||||
|
|
||||||
function Console(callback) {
|
function Console() {
|
||||||
this.callback = callback != null ? callback : null;
|
this.displayFailure = __bind(this.displayFailure, this);
|
||||||
this._waitRunner = __bind(this._waitRunner, this);
|
this.displaySuccess = __bind(this.displaySuccess, this);
|
||||||
Console.__super__.constructor.call(this, this.callback);
|
Console.__super__.constructor.apply(this, arguments);
|
||||||
this.position = 0;
|
|
||||||
this.positions = "|/-\\";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Console.prototype.reportRunnerResults = function(runner) {
|
Console.prototype.displaySuccess = function(spec) {
|
||||||
var result, resultLine, _i, _len, _ref;
|
return this.print('.'.foreground('green'));
|
||||||
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.reportRunnerStarting = function(runner) {
|
Console.prototype.displayFailure = function(spec) {
|
||||||
Console.__super__.reportRunnerStarting.call(this, runner);
|
return this.print('F'.foreground('red'));
|
||||||
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);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
return Console;
|
return Console;
|
||||||
|
118
vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.js
vendored
Normal file
118
vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.js
vendored
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
(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);
|
48
vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js
vendored
Normal file
48
vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.js
vendored
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
(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.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;
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
}).call(this);
|
Loading…
Reference in New Issue
Block a user