Skip to content

Commit

Permalink
Output errors outside of examples
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyazub committed Jun 4, 2024
1 parent 99a0e04 commit 84f2487
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
3 changes: 2 additions & 1 deletion lib/turbo_tests/reporter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ def message(message)
@messages << message
end

def error_outside_of_examples
def error_outside_of_examples(error_message)
@errors_outside_of_examples_count += 1
message error_message
end

def finish
Expand Down
11 changes: 8 additions & 3 deletions lib/turbo_tests/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -259,12 +259,17 @@ def handle_messages
break
end
when "message"
@reporter.message(message[:message])
if message[:message].include?("An error occurred") || message[:message].include?("occurred outside of examples")
@reporter.error_outside_of_examples(message[:message])
@error = true
else
@reporter.message(message[:message])
end
when "seed"
when "close"
when "error"
@reporter.error_outside_of_examples
@error = true
# Do nothing
nil
when "exit"
exited += 1
if exited == @num_processes
Expand Down
4 changes: 2 additions & 2 deletions spec/cli_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

let(:expected_end_of_output) do
"0 examples, 0 failures\n"\
"0 examples, 0 failures, 1 error occurred outside of examples\n"\
"\n"\
"Randomized with seed #{seed}"
end
Expand Down Expand Up @@ -81,7 +81,7 @@
}

let(:expected_end_of_output) do
"0 examples, 0 failures"
"0 examples, 0 failures, 1 error occurred outside of examples"
end

let(:fixture) { "./fixtures/rspec/errors_outside_of_examples_spec.rb" }
Expand Down

0 comments on commit 84f2487

Please sign in to comment.