@@ -47,6 +47,7 @@ var AggregateResultsCmd = &cobra.Command{
47
47
s := spinner .New (spinner .CharSets [11 ], 100 * time .Millisecond )
48
48
s .Suffix = " Aggregating test reports..."
49
49
s .Start ()
50
+ fmt .Println ()
50
51
51
52
// Load test reports from JSON files and aggregate them
52
53
aggregatedReport , err := reports .LoadAndAggregate (
@@ -62,12 +63,10 @@ var AggregateResultsCmd = &cobra.Command{
62
63
)
63
64
if err != nil {
64
65
s .Stop ()
65
- fmt .Println ()
66
- log .Error ().Err (err ).Msg ("Error aggregating test reports" )
66
+ log .Error ().Err (err ).Stack ().Msg ("Error aggregating test reports" )
67
67
os .Exit (ErrorExitCode )
68
68
}
69
69
s .Stop ()
70
- fmt .Println ()
71
70
log .Debug ().Msg ("Successfully loaded and aggregated test reports" )
72
71
73
72
// Start spinner for mapping test results to paths
@@ -79,37 +78,33 @@ var AggregateResultsCmd = &cobra.Command{
79
78
err = reports .MapTestResultsToPaths (aggregatedReport , repoPath )
80
79
if err != nil {
81
80
s .Stop ()
82
- fmt .Println ()
83
- log .Error ().Err (err ).Msg ("Error mapping test results to paths" )
81
+ log .Error ().Stack ().Err (err ).Msg ("Error mapping test results to paths" )
84
82
os .Exit (ErrorExitCode )
85
83
}
86
84
s .Stop ()
87
- fmt .Println ()
88
85
log .Debug ().Msg ("Successfully mapped paths to test results" )
89
86
90
87
// Map test results to code owners if codeOwnersPath is provided
91
88
if codeOwnersPath != "" {
92
89
s = spinner .New (spinner .CharSets [11 ], 100 * time .Millisecond )
93
90
s .Suffix = " Mapping test results to code owners..."
94
91
s .Start ()
92
+ fmt .Println ()
95
93
96
94
err = reports .MapTestResultsToOwners (aggregatedReport , codeOwnersPath )
97
95
if err != nil {
98
96
s .Stop ()
99
- fmt .Println ()
100
- log .Error ().Err (err ).Msg ("Error mapping test results to code owners" )
97
+ log .Error ().Stack ().Err (err ).Msg ("Error mapping test results to code owners" )
101
98
os .Exit (ErrorExitCode )
102
99
}
103
100
s .Stop ()
104
- fmt .Println ()
105
101
log .Debug ().Msg ("Successfully mapped code owners to test results" )
106
102
}
107
103
108
104
failedTests := reports .FilterTests (aggregatedReport .Results , func (tr reports.TestResult ) bool {
109
105
return ! tr .Skipped && tr .PassRatio < maxPassRatio
110
106
})
111
107
s .Stop ()
112
- fmt .Println ()
113
108
114
109
// Check if there are any failed tests
115
110
if len (failedTests ) > 0 {
@@ -118,7 +113,7 @@ var AggregateResultsCmd = &cobra.Command{
118
113
// Create a new report for failed tests with logs
119
114
failedReportWithLogs := & reports.TestReport {
120
115
GoProject : aggregatedReport .GoProject ,
121
- TestRunCount : aggregatedReport .TestRunCount ,
116
+ SummaryData : aggregatedReport .SummaryData ,
122
117
RaceDetection : aggregatedReport .RaceDetection ,
123
118
ExcludedTests : aggregatedReport .ExcludedTests ,
124
119
SelectedTests : aggregatedReport .SelectedTests ,
@@ -131,7 +126,7 @@ var AggregateResultsCmd = &cobra.Command{
131
126
// Save the failed tests report with logs
132
127
failedTestsReportWithLogsPath := filepath .Join (outputDir , "failed-test-results-with-logs.json" )
133
128
if err := reports .SaveReport (fs , failedTestsReportWithLogsPath , * failedReportWithLogs ); err != nil {
134
- log .Error ().Err (err ).Msg ("Error saving failed tests report with logs" )
129
+ log .Error ().Stack (). Err (err ).Msg ("Error saving failed tests report with logs" )
135
130
os .Exit (ErrorExitCode )
136
131
}
137
132
log .Debug ().Str ("path" , failedTestsReportWithLogsPath ).Msg ("Failed tests report with logs saved" )
@@ -146,7 +141,7 @@ var AggregateResultsCmd = &cobra.Command{
146
141
// Save the failed tests report without logs
147
142
failedTestsReportNoLogsPath := filepath .Join (outputDir , "failed-test-results.json" )
148
143
if err := reports .SaveReport (fs , failedTestsReportNoLogsPath , * failedReportWithLogs ); err != nil {
149
- log .Error ().Err (err ).Msg ("Error saving failed tests report without logs" )
144
+ log .Error ().Stack (). Err (err ).Msg ("Error saving failed tests report without logs" )
150
145
os .Exit (ErrorExitCode )
151
146
}
152
147
log .Debug ().Str ("path" , failedTestsReportNoLogsPath ).Msg ("Failed tests report without logs saved" )
@@ -164,7 +159,7 @@ var AggregateResultsCmd = &cobra.Command{
164
159
// Save the aggregated report to the output directory
165
160
aggregatedReportPath := filepath .Join (outputDir , "all-test-results.json" )
166
161
if err := reports .SaveReport (fs , aggregatedReportPath , * aggregatedReport ); err != nil {
167
- log .Error ().Err (err ).Msg ("Error saving aggregated test report" )
162
+ log .Error ().Stack (). Err (err ).Msg ("Error saving aggregated test report" )
168
163
os .Exit (ErrorExitCode )
169
164
}
170
165
log .Debug ().Str ("path" , aggregatedReportPath ).Msg ("Aggregated test report saved" )
@@ -175,17 +170,17 @@ var AggregateResultsCmd = &cobra.Command{
175
170
s = spinner .New (spinner .CharSets [11 ], 100 * time .Millisecond )
176
171
s .Suffix = " Generating summary json..."
177
172
s .Start ()
173
+ fmt .Println ()
178
174
179
175
summaryFilePath = filepath .Join (outputDir , summaryFileName )
180
176
err = generateAllTestsSummaryJSON (aggregatedReport , summaryFilePath , maxPassRatio )
181
177
if err != nil {
182
178
s .Stop ()
183
179
fmt .Println ()
184
- log .Error ().Err (err ).Msg ("Error generating summary json" )
180
+ log .Error ().Stack (). Err (err ).Msg ("Error generating summary json" )
185
181
os .Exit (ErrorExitCode )
186
182
}
187
183
s .Stop ()
188
- fmt .Println ()
189
184
log .Debug ().Str ("path" , summaryFilePath ).Msg ("Summary generated" )
190
185
}
191
186
0 commit comments