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

Refactor StartXCTest Method to return errors.Join Instead of []error #569

Merged
merged 1 commit into from
Feb 19, 2025
Merged
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
13 changes: 5 additions & 8 deletions ios/testmanagerd/xcuitestrunner.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,21 +249,17 @@ type TestConfig struct {
Listener *TestListener
}

func StartXCTestWithConfig(ctx context.Context, xctestrunFilePath string, device ios.DeviceEntry, listener *TestListener) ([]TestSuite, []error) {
func StartXCTestWithConfig(ctx context.Context, xctestrunFilePath string, device ios.DeviceEntry, listener *TestListener) ([]TestSuite, error) {
xctestSpecification, err := parseFile(xctestrunFilePath)
if err != nil {
return nil, []error{
fmt.Errorf("error parsing xctestrun file: %w", err),
}
return nil, fmt.Errorf("error parsing xctestrun file: %w", err)
}
installedApps := getUserInstalledApps(err, device)
var xcTestTargets []TestConfig
for i, r := range xctestSpecification {
tc, err := r.buildTestConfig(device, listener, installedApps)
if err != nil {
return nil, []error{
fmt.Errorf("building test config at index %d: %w", i, err),
}
return nil, fmt.Errorf("building test config at index %d: %w", i, err)
}
xcTestTargets = append(xcTestTargets, tc)
}
Expand All @@ -278,7 +274,8 @@ func StartXCTestWithConfig(ctx context.Context, xctestrunFilePath string, device
}
results = append(results, suites...)
}
return results, targetErrors

return results, errors.Join(targetErrors...)
}

func RunTestWithConfig(ctx context.Context, testConfig TestConfig) ([]TestSuite, error) {
Expand Down
Loading