diff --git a/lib/jasmine/headless/report.rb b/lib/jasmine/headless/report.rb index ab05c35..d620b73 100644 --- a/lib/jasmine/headless/report.rb +++ b/lib/jasmine/headless/report.rb @@ -20,13 +20,20 @@ module Jasmine::Headless end def process + last_message = nil @report = File.readlines(file).collect do |line| type, *parts = line.split('||', -1) - parts.last.strip! - Jasmine::Headless::ReportMessage.const_get( - Jasmine::Headless::ReportMessage.constants.find { |k| k.to_s.downcase == type.downcase } - ).new_from_parts(parts) + if !(report_klass = report_class_for(type)) + if last_message.kind_of?(Jasmine::Headless::ReportMessage::Console) + last_message.message << "\n" + last_message.message << line.strip + end + else + parts.last.strip! + + last_message = report_klass.new_from_parts(parts) + end end self end @@ -58,6 +65,12 @@ module Jasmine::Headless def last_total @report.reverse.find { |entry| entry.respond_to?(:total) } end + + def report_class_for(type) + if constant = ReportMessage.constants.find { |k| k.to_s.downcase == type.downcase } + ReportMessage.const_get(constant) + end + end end end diff --git a/spec/lib/jasmine/headless/report_spec.rb b/spec/lib/jasmine/headless/report_spec.rb index c97d8ae..9899a9c 100644 --- a/spec/lib/jasmine/headless/report_spec.rb +++ b/spec/lib/jasmine/headless/report_spec.rb @@ -60,6 +60,20 @@ REPORT report.failed_files.should == [] end end + + context 'multi line console' do + before do + File.open(file, 'wb') { |fh| fh.puts <<-REPORT } +CONSOLE||test +test2 +TOTAL||1||2||3||T +REPORT + end + + it 'should read the report file' do + report[0].should == Jasmine::Headless::ReportMessage::Console.new("test\ntest2") + end + end end end