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

[trainer] check specifically for file url in failure_message, fixing crash in Xcode 15 when running in Apple Silicon #21493

Merged
2 changes: 1 addition & 1 deletion trainer/lib/trainer/xcresult.rb
Expand Up @@ -391,7 +391,7 @@ def initialize(data)

def failure_message
new_message = self.message
if self.document_location_in_creating_workspace
if self.document_location_in_creating_workspace&.url
file_path = self.document_location_in_creating_workspace.url.gsub("file://", "")
new_message += " (#{file_path})"
end
Expand Down
9 changes: 9 additions & 0 deletions trainer/spec/test_parser_spec.rb
Expand Up @@ -198,6 +198,15 @@
}
])
end

it "still produces a test failure message when file url is missing", requires_xcode: true do
allow_any_instance_of(Trainer::XCResult::TestFailureIssueSummary).to receive(:document_location_in_creating_workspace).and_return(nil)
tp = Trainer::TestParser.new("./trainer/spec/fixtures/Test.test_result.xcresult")
test_failures = tp.data.last[:tests].select { |t| t[:failures] }
failure_messages = test_failures.map { |tf| tf[:failures].first[:failure_message] }
expect(failure_messages).to eq(["XCTAssertTrue failed", "XCTAssertTrue failed"])
RSpec::Mocks.space.proxy_for(Trainer::XCResult::TestFailureIssueSummary).reset
end
end
end
end