diff --git a/lib/rspec/github/formatter.rb b/lib/rspec/github/formatter.rb index 56a80aa..ff5e007 100644 --- a/lib/rspec/github/formatter.rb +++ b/lib/rspec/github/formatter.rb @@ -10,12 +10,12 @@ class Formatter < RSpec::Core::Formatters::BaseFormatter def example_failed(failure) file, line = failure.example.location.split(':') - output.puts "::error file=#{file},line=#{line}::#{failure.message_lines.join('%0A')}" + output.puts "\n::error file=#{file},line=#{line}::#{failure.message_lines.join('%0A')}" end def example_pending(pending) file, line = pending.example.location.split(':') - output.puts "::warning file=#{file},line=#{line}::#{pending.example.full_description}" + output.puts "\n::warning file=#{file},line=#{line}::#{pending.example.full_description}" end end end diff --git a/spec/rspec/github/formatter_spec.rb b/spec/rspec/github/formatter_spec.rb index 95aa3c7..8d6d0c9 100644 --- a/spec/rspec/github/formatter_spec.rb +++ b/spec/rspec/github/formatter_spec.rb @@ -42,6 +42,7 @@ it 'outputs the GitHub annotation formatted error' do is_expected.to eq <<~MESSAGE + ::error file=./spec/models/user_spec.rb,line=12::#{notification.message_lines.join('%0A')} MESSAGE end @@ -59,6 +60,7 @@ it 'outputs the GitHub annotation formatted error' do is_expected.to eq <<~MESSAGE + ::warning file=./spec/models/user_spec.rb,line=12::#{example.full_description} MESSAGE end