@@ -47,6 +47,7 @@ var AggregateResultsCmd = &cobra.Command{
4747 s := spinner .New (spinner .CharSets [11 ], 100 * time .Millisecond )
4848 s .Suffix = " Aggregating test reports..."
4949 s .Start ()
50+ fmt .Println ()
5051
5152 // Load test reports from JSON files and aggregate them
5253 aggregatedReport , err := reports .LoadAndAggregate (
@@ -62,12 +63,10 @@ var AggregateResultsCmd = &cobra.Command{
6263 )
6364 if err != nil {
6465 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" )
6767 os .Exit (ErrorExitCode )
6868 }
6969 s .Stop ()
70- fmt .Println ()
7170 log .Debug ().Msg ("Successfully loaded and aggregated test reports" )
7271
7372 // Start spinner for mapping test results to paths
@@ -79,37 +78,33 @@ var AggregateResultsCmd = &cobra.Command{
7978 err = reports .MapTestResultsToPaths (aggregatedReport , repoPath )
8079 if err != nil {
8180 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" )
8482 os .Exit (ErrorExitCode )
8583 }
8684 s .Stop ()
87- fmt .Println ()
8885 log .Debug ().Msg ("Successfully mapped paths to test results" )
8986
9087 // Map test results to code owners if codeOwnersPath is provided
9188 if codeOwnersPath != "" {
9289 s = spinner .New (spinner .CharSets [11 ], 100 * time .Millisecond )
9390 s .Suffix = " Mapping test results to code owners..."
9491 s .Start ()
92+ fmt .Println ()
9593
9694 err = reports .MapTestResultsToOwners (aggregatedReport , codeOwnersPath )
9795 if err != nil {
9896 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" )
10198 os .Exit (ErrorExitCode )
10299 }
103100 s .Stop ()
104- fmt .Println ()
105101 log .Debug ().Msg ("Successfully mapped code owners to test results" )
106102 }
107103
108104 failedTests := reports .FilterTests (aggregatedReport .Results , func (tr reports.TestResult ) bool {
109105 return ! tr .Skipped && tr .PassRatio < maxPassRatio
110106 })
111107 s .Stop ()
112- fmt .Println ()
113108
114109 // Check if there are any failed tests
115110 if len (failedTests ) > 0 {
@@ -118,7 +113,7 @@ var AggregateResultsCmd = &cobra.Command{
118113 // Create a new report for failed tests with logs
119114 failedReportWithLogs := & reports.TestReport {
120115 GoProject : aggregatedReport .GoProject ,
121- TestRunCount : aggregatedReport .TestRunCount ,
116+ SummaryData : aggregatedReport .SummaryData ,
122117 RaceDetection : aggregatedReport .RaceDetection ,
123118 ExcludedTests : aggregatedReport .ExcludedTests ,
124119 SelectedTests : aggregatedReport .SelectedTests ,
@@ -131,7 +126,7 @@ var AggregateResultsCmd = &cobra.Command{
131126 // Save the failed tests report with logs
132127 failedTestsReportWithLogsPath := filepath .Join (outputDir , "failed-test-results-with-logs.json" )
133128 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" )
135130 os .Exit (ErrorExitCode )
136131 }
137132 log .Debug ().Str ("path" , failedTestsReportWithLogsPath ).Msg ("Failed tests report with logs saved" )
@@ -146,7 +141,7 @@ var AggregateResultsCmd = &cobra.Command{
146141 // Save the failed tests report without logs
147142 failedTestsReportNoLogsPath := filepath .Join (outputDir , "failed-test-results.json" )
148143 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" )
150145 os .Exit (ErrorExitCode )
151146 }
152147 log .Debug ().Str ("path" , failedTestsReportNoLogsPath ).Msg ("Failed tests report without logs saved" )
@@ -164,7 +159,7 @@ var AggregateResultsCmd = &cobra.Command{
164159 // Save the aggregated report to the output directory
165160 aggregatedReportPath := filepath .Join (outputDir , "all-test-results.json" )
166161 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" )
168163 os .Exit (ErrorExitCode )
169164 }
170165 log .Debug ().Str ("path" , aggregatedReportPath ).Msg ("Aggregated test report saved" )
@@ -175,17 +170,17 @@ var AggregateResultsCmd = &cobra.Command{
175170 s = spinner .New (spinner .CharSets [11 ], 100 * time .Millisecond )
176171 s .Suffix = " Generating summary json..."
177172 s .Start ()
173+ fmt .Println ()
178174
179175 summaryFilePath = filepath .Join (outputDir , summaryFileName )
180176 err = generateAllTestsSummaryJSON (aggregatedReport , summaryFilePath , maxPassRatio )
181177 if err != nil {
182178 s .Stop ()
183179 fmt .Println ()
184- log .Error ().Err (err ).Msg ("Error generating summary json" )
180+ log .Error ().Stack (). Err (err ).Msg ("Error generating summary json" )
185181 os .Exit (ErrorExitCode )
186182 }
187183 s .Stop ()
188- fmt .Println ()
189184 log .Debug ().Str ("path" , summaryFilePath ).Msg ("Summary generated" )
190185 }
191186
0 commit comments