better support for when we don't know spec line location
This commit is contained in:
parent
6bf64edb32
commit
363ee91b6b
@ -18,7 +18,10 @@ jasmine.Spec.prototype.getSplitName = getSplitName
|
|||||||
jasmine.Spec.prototype.getJHWSpecInformation = ->
|
jasmine.Spec.prototype.getJHWSpecInformation = ->
|
||||||
parts = this.getSpecSplitName()
|
parts = this.getSpecSplitName()
|
||||||
specLineInfo = HeadlessReporterResult.findSpecLine(parts)
|
specLineInfo = HeadlessReporterResult.findSpecLine(parts)
|
||||||
|
if specLineInfo.file
|
||||||
parts.push("#{specLineInfo.file}:#{specLineInfo.lineNumber}")
|
parts.push("#{specLineInfo.file}:#{specLineInfo.lineNumber}")
|
||||||
|
else
|
||||||
|
parts.push('')
|
||||||
parts.join("||")
|
parts.join("||")
|
||||||
|
|
||||||
if !jasmine.WaitsBlock.prototype._execute
|
if !jasmine.WaitsBlock.prototype._execute
|
||||||
|
@ -19,7 +19,11 @@
|
|||||||
var parts, specLineInfo;
|
var parts, specLineInfo;
|
||||||
parts = this.getSpecSplitName();
|
parts = this.getSpecSplitName();
|
||||||
specLineInfo = HeadlessReporterResult.findSpecLine(parts);
|
specLineInfo = HeadlessReporterResult.findSpecLine(parts);
|
||||||
|
if (specLineInfo.file) {
|
||||||
parts.push("" + specLineInfo.file + ":" + specLineInfo.lineNumber);
|
parts.push("" + specLineInfo.file + ":" + specLineInfo.lineNumber);
|
||||||
|
} else {
|
||||||
|
parts.push('');
|
||||||
|
}
|
||||||
return parts.join("||");
|
return parts.join("||");
|
||||||
};
|
};
|
||||||
if (!jasmine.WaitsBlock.prototype._execute) {
|
if (!jasmine.WaitsBlock.prototype._execute) {
|
||||||
|
@ -21,7 +21,8 @@ module Jasmine::Headless
|
|||||||
|
|
||||||
def process
|
def process
|
||||||
@report = File.readlines(file).collect do |line|
|
@report = File.readlines(file).collect do |line|
|
||||||
type, *parts = line.split('||')
|
type, *parts = line.split('||', -1)
|
||||||
|
parts.last.strip!
|
||||||
|
|
||||||
Jasmine::Headless::ReportMessage.const_get(
|
Jasmine::Headless::ReportMessage.const_get(
|
||||||
Jasmine::Headless::ReportMessage.constants.find { |k| k.to_s.downcase == type.downcase }
|
Jasmine::Headless::ReportMessage.constants.find { |k| k.to_s.downcase == type.downcase }
|
||||||
@ -49,7 +50,7 @@ module Jasmine::Headless
|
|||||||
def failed_files
|
def failed_files
|
||||||
@report.find_all { |entry|
|
@report.find_all { |entry|
|
||||||
entry.kind_of?(Jasmine::Headless::ReportMessage::Fail)
|
entry.kind_of?(Jasmine::Headless::ReportMessage::Fail)
|
||||||
}.collect(&:filename).uniq
|
}.collect(&:filename).uniq.compact
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
@ -19,7 +19,11 @@ module Jasmine::Headless::ReportMessage
|
|||||||
end
|
end
|
||||||
|
|
||||||
def filename
|
def filename
|
||||||
file_info.split(":").first
|
if name = file_info.split(":").first
|
||||||
|
name
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -61,6 +61,13 @@ describe 'jasmine.Spec.prototype.getSuiteSplitName', ->
|
|||||||
spec.description = 1
|
spec.description = 1
|
||||||
expect(spec.getSpecSplitName()).toEqual([ "1" ])
|
expect(spec.getSpecSplitName()).toEqual([ "1" ])
|
||||||
|
|
||||||
|
describe 'jasmine.Spec.prototype.getJHWSpecInformation', ->
|
||||||
|
it 'should append null when there is no file information', ->
|
||||||
|
spec = new jasmine.Spec({}, {})
|
||||||
|
spyOn(spec, 'getSpecSplitName').andReturn(["one"])
|
||||||
|
spyOn(HeadlessReporterResult, 'findSpecLine').andReturn({})
|
||||||
|
expect(spec.getJHWSpecInformation()).toEqual("one||")
|
||||||
|
|
||||||
describe 'jasmine.WaitsBlock and jasmine.WaitsForBlock', ->
|
describe 'jasmine.WaitsBlock and jasmine.WaitsForBlock', ->
|
||||||
beforeEach ->
|
beforeEach ->
|
||||||
it 'should notify JHW of waiting', ->
|
it 'should notify JHW of waiting', ->
|
||||||
|
@ -1,11 +1,20 @@
|
|||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe Jasmine::Headless::ReportMessage::Spec do
|
describe Jasmine::Headless::ReportMessage::Spec do
|
||||||
|
subject { spec }
|
||||||
|
|
||||||
|
context 'with filename' do
|
||||||
let(:filename) { 'file.js' }
|
let(:filename) { 'file.js' }
|
||||||
let(:spec) { described_class.new("Test", "#{filename}:23") }
|
let(:spec) { described_class.new("Test", "#{filename}:23") }
|
||||||
|
|
||||||
subject { spec }
|
|
||||||
|
|
||||||
its(:filename) { should == filename }
|
its(:filename) { should == filename }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'without filename' do
|
||||||
|
let(:filename) { 'file.js' }
|
||||||
|
let(:spec) { described_class.new("Test", "") }
|
||||||
|
|
||||||
|
its(:filename) { should be_nil }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
@ -47,6 +47,19 @@ REPORT
|
|||||||
report.failed_files.should == [ 'file2.js' ]
|
report.failed_files.should == [ 'file2.js' ]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'nil filed file' do
|
||||||
|
before do
|
||||||
|
File.open(file, 'wb') { |fh| fh.puts <<-REPORT }
|
||||||
|
FAIL||Statement||Two||
|
||||||
|
TOTAL||1||2||3||T
|
||||||
|
REPORT
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should read the report file' do
|
||||||
|
report.failed_files.should == []
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user