Skip to content

Commit

Permalink
Add FailureListFormatter that outputs failures to log/rspec-failures.log
Browse files Browse the repository at this point in the history
  • Loading branch information
RohanM committed May 24, 2019
1 parent bf1cee3 commit 0830e43
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bin/rspec-queue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env ruby
require 'rspec_queue/server_runner'
require 'rspec_queue/formatter'
require 'rspec_queue/failure_list_formatter'

ENV['SPEC_OPTS'] = "--format RSpecQueue::Formatter" unless ENV['SPEC_OPTS']
ENV['SPEC_OPTS'] = "--format RSpecQueue::Formatter --format RSpecQueue::FailureListFormatter --out log/rspec-failures.log" unless ENV['SPEC_OPTS']
RSpecQueue::ServerRunner.invoke
1 change: 1 addition & 0 deletions bin/rspec-queue-worker
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env ruby
require 'rspec_queue/worker_runner'
require 'rspec_queue/formatter'
require 'rspec_queue/failure_list_formatter'

RSpecQueue::WorkerRunner.invoke
19 changes: 19 additions & 0 deletions lib/rspec_queue/failure_list_formatter.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'rspec/core/formatters'

module RSpecQueue
# Taken from rspec-core 3.9.0.pre FailureListFormatter
class FailureListFormatter < RSpec::Core::Formatters::BaseFormatter
RSpec::Core::Formatters.register self, :example_failed, :dump_profile, :message

def example_failed(failure)
output.puts "#{failure.example.location}:#{failure.example.description}"
end

# Discard profile and messages
#
# These outputs are not really relevant in the context of this failure
# list formatter.
def dump_profile(_profile); end
def message(_message); end
end
end

0 comments on commit 0830e43

Please sign in to comment.