Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RSpec] [Queue Mode] Log error message and backtrace when unexpected failure raised in process #249

Merged
merged 1 commit into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/knapsack_pro/runners/queue/rspec_runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def run
Kernel.exit(exit_code)
rescue Exception => exception
KnapsackPro.logger.error("An unexpected exception happened. RSpec cannot handle it. The exception: #{exception.inspect}")
KnapsackPro.logger.error("Exception message: #{exception.message}")
KnapsackPro.logger.error("Exception backtrace: #{exception.backtrace.join("\n")}")

message = @rspec_pure.exit_summary(unexecuted_test_files)
KnapsackPro.logger.warn(message) if message
Expand Down
2 changes: 2 additions & 0 deletions spec/integration/runners/queue/rspec_runner_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,8 @@ def when_first_matching_example_defined(type:)

expect(actual.stdout).to include('B_describe')
expect(actual.stdout).to include('An unexpected exception happened. RSpec cannot handle it. The exception: #<NoMemoryError: NoMemoryError>')
expect(actual.stdout).to include('Exception message: ')
expect(actual.stdout).to include('Exception backtrace: ')
expect(actual.stdout).to_not include('B1 test example')

expect(actual.stdout).to_not include('C1 test example')
Expand Down