trainer/lib/trainer/xcresult.rb in fastlane-2.219.0 vs trainer/lib/trainer/xcresult.rb in fastlane-2.220.0
- old
+ new
@@ -171,10 +171,12 @@
def all_subtests
return [self]
end
def find_failure(failures)
+ sanitizer = proc { |name| name.gsub(/\W/, "_") }
+ sanitized_identifier = sanitizer.call(self.identifier)
if self.test_status == "Failure"
# Tries to match failure on test case name
# Example TestFailureIssueSummary:
# producingTarget: "TestThisDude"
# test_case_name: "TestThisDude.testFailureJosh2()" (when Swift)
@@ -182,19 +184,13 @@
# Example ActionTestMetadata
# identifier: "TestThisDude/testFailureJosh2()" (when Swift)
# or identifier: "TestThisDude/testFailureJosh2" (when Objective-C)
found_failure = failures.find do |failure|
- # Clean test_case_name to match identifier format
- # Sanitize for Swift by replacing "." for "/"
- # Sanitize for Objective-C by removing "-", "[", "]", and replacing " " for ?/
- sanitized_test_case_name = failure.test_case_name
- .tr(".", "/")
- .tr("-", "")
- .tr("[", "")
- .tr("]", "")
- .tr(" ", "/")
- self.identifier == sanitized_test_case_name
+ # Sanitize both test case name and identifier in a consistent fashion, then replace all non-word
+ # chars with underscore, and compare them
+ sanitized_test_case_name = sanitizer.call(failure.test_case_name)
+ sanitized_identifier == sanitized_test_case_name
end
return found_failure
else
return nil
end