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

Ignore test_failures if the overall status is 'succeeded' #77

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
danger-xcode_summary (1.2.0)
danger-xcode_summary (1.2.1)
danger-plugin-api (~> 1.0)
xcresult (~> 0.2)

Expand Down
2 changes: 1 addition & 1 deletion lib/xcode_summary/gem_version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module XcodeSummary
VERSION = '1.2.0'
VERSION = '1.2.1'
end
18 changes: 11 additions & 7 deletions lib/xcode_summary/plugin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -183,16 +183,20 @@ def errors(action)
Result.new(format_warning(result), result.location)
end

test_failures = [
action.action_result.issues.test_failure_summaries,
action.build_result.issues.test_failure_summaries
].flatten.compact.map do |summary|
result = Result.new(summary.message, parse_location(summary.document_location_in_creating_workspace))
Result.new(format_test_failure(result, summary.producing_target, summary.test_case_name),
if action.action_result.status != 'succeeded' then
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this fully fixes the issue though. For example, If I have 2 tests, one which passed on 2nd iteration and another which failed all iterations, then this would post 2 test failures to the PR instead of just 1. Could lead to confusing results?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jwelton you are 100% right, this really only fixes the case where the overall action succeeds with after a retry. Looking further into this, I'm wondering if this needs to be handled in the xcresult gem itself...

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_failures = [
action.action_result.issues.test_failure_summaries,
action.build_result.issues.test_failure_summaries
].flatten.compact.map do |summary|
result = Result.new(summary.message, parse_location(summary.document_location_in_creating_workspace))
Result.new(format_test_failure(result, summary.producing_target, summary.test_case_name),
result.location)
end
results = (errors + test_failures).uniq.reject { |result| result.message.nil? }
else
results = (errors).uniq.reject { |result| result.message.nil? }
end

results = (errors + test_failures).uniq.reject { |result| result.message.nil? }
results.delete_if(&ignored_results)
end

Expand Down